Why does pulsout double the period
Archiver
Posts: 46,084
The period you specify is multiplied by an actual time constant that varies
according to the Stamp you have. See Page 243 of the 2.0c Stamp manual for
more info.
Since you say it appears to double the value, its safe to assume you have a
BS2 or BS2E. The constant for a BS2 / BS2E is 2 us (microseconds) --
multiply this by the period you specified, 210, and this gives you a 420 us
pulse duration.
Original Message
> Ok I already posted and I didn't really get the answer I was looking for.
> I understand that you use pulsout like this:
>
> pulsout 0,210
>
> which would invert p0 for period and then change it back. The time it
> stays inverted is period yes? Ok thats fine but why does it double what
> you give the routine?
according to the Stamp you have. See Page 243 of the 2.0c Stamp manual for
more info.
Since you say it appears to double the value, its safe to assume you have a
BS2 or BS2E. The constant for a BS2 / BS2E is 2 us (microseconds) --
multiply this by the period you specified, 210, and this gives you a 420 us
pulse duration.
Original Message
> Ok I already posted and I didn't really get the answer I was looking for.
> I understand that you use pulsout like this:
>
> pulsout 0,210
>
> which would invert p0 for period and then change it back. The time it
> stays inverted is period yes? Ok thats fine but why does it double what
> you give the routine?
Comments
in 2 uS 'ticks'. That is, a value of '1' gives you a
2 uS pulse. The value is really how long you want it
to stay high, in 2 uS units.
--- In basicstamps@yahoogroups.com, Hudson T Clark
<dark_archon1@j...> wrote:
> Ok I already posted and I didn't really get the answer I was
looking for.
> I understand that you use pulsout like this:
>
> pulsout 0,210
>
> which would invert p0 for period and then change it back. The time
it
> stays inverted is period yes? Ok thats fine but why does it double
what
> you give the routine?
the output status of a pin, increment a 16-bit timer, check for timer
expiration, loop if necessary or alternatively reverse the output
state on a pin all within 1 usec. Doing all the above with 2 usec
resolution is no mean feat.
Another nice thing about the PULSOUT implementation is that it allows
you to specify a 17-bit value (albeit always even) with a 16-bit
argument. So even though PBASIC doesn't deal with numbers greater
than 65,535, you can indirectly specify a 131,070 usec pulse.
Steve
On 15 Jun 03 at 15:16, Hudson T Clark wrote:
> Ok I already posted and I didn't really get the answer I was looking
> for. I understand that you use pulsout like this:
>
> pulsout 0,210
>
> which would invert p0 for period and then change it back. The time
> it stays inverted is period yes? Ok thats fine but why does it
> double what you give the routine?
I understand that you use pulsout like this:
pulsout 0,210
which would invert p0 for period and then change it back. The time it
stays inverted is period yes? Ok thats fine but why does it double what
you give the routine?
really even giving it a time you are giving it how many units of the
specific stamps time unit is.
In my case I'm using the bs2 so yeah... hehehe... one unit is 2us.