reducing unit time of pause command
Archiver
Posts: 46,084
Hello,
is it possible to reduce the unit time of 1ms for the PAUSE command?
I'm working on a project that requires me to send square pulses with
a max period of 1ms, 50% duty cycle. And it seems I can't do that
with the Basic Stamp.... or is it possible?
is it possible to reduce the unit time of 1ms for the PAUSE command?
I'm working on a project that requires me to send square pulses with
a max period of 1ms, 50% duty cycle. And it seems I can't do that
with the Basic Stamp.... or is it possible?
Comments
question: i should be able to set the PULSOUT command to give a pulse
of 0.5ms, but how do I get the low signal of 0V to stay for 0.5 ms.
The minimum I can wait is 1ms with the PAUSE command.
The pulse signal I need is 0.5ms 5V square pulse / 0.5ms 0V cycle.
--- In basicstamps@y..., "peter verkaik" <peterverkaik@b...> wrote:
> Hi,
>
> How about the pulsout command used in a loop?
> That may help tou.
>
> Regards peter
>
>
>
Oorspronkelijk bericht
> Van: direwyrmsg@y... [noparse][[/noparse]mailto:direwyrmsg@y...]
> Verzonden: maandag 26 november 2001 20:50
> Aan: basicstamps@y...
> Onderwerp: [noparse][[/noparse]basicstamps] reducing unit time of pause command
>
> Hello,
> is it possible to reduce the unit time of 1ms for the PAUSE command?
> I'm working on a project that requires me to send square pulses with
> a max period of 1ms, 50% duty cycle. And it seems I can't do that
> with the Basic Stamp.... or is it possible?
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@y...
> from the same email address that you subscribed. Text in the
Subject and
> Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
direwyrmsg@y... writes:
> is it possible to reduce the unit time of 1ms for the PAUSE command?
> I'm working on a project that requires me to send square pulses with
> a max period of 1ms, 50% duty cycle. And it seems I can't do that
>
Try FREQOUT instead. A ms period means the frequency would be 1000 hertz.
You may need to look at it with a scope though, just to make sure it meets
your requirements.
-- Jon Williams
-- Parallax
[noparse][[/noparse]Non-text portions of this message have been removed]
>is it possible to reduce the unit time of 1ms for the PAUSE command?
>I'm working on a project that requires me to send square pulses with
>a max period of 1ms, 50% duty cycle. And it seems I can't do that
>with the Basic Stamp.... or is it possible?
The Stamp is a relatively slow processor, and the minimum time for
any individual command is around 140 microseconds. A pause 1 command
on the BS2 actually takes close to 1.235 milliseconds, because of the
overhead of the interpreter.
The following loop takes close to 800 microseconds to execute on the
BS2, so it would create a square wave with a period of 0.8
millisecond on P1.
loop:
toggle 1 ' 145 microseconds for toggle, 255 for goto
goto loop
That does not give you much leeway to play with the timing or to add
a conditional exit from the loop. The BS2sx or BS2p are faster,
e.g., the BS2sx the output period as written would be 0.32
milliseconds, and that would give you enough time to make fine
adjustments if necessary.
A for-next loop would give a way out. Here is 500 cycles at a period
of about 0.915 millisecond (BS2) or 0.366 millisecond (BS2sx)...
for i=0 to 500
toggle 1 ' 145 uS for toggle, 770 for FOR-NEXT
next
You said you need a max period of 1 ms, but is there also a minimum
requirement?
More Stamp timing parameters at:
http://www.emesystems.com/BS2speed.htm
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
How about the pulsout command used in a loop?
That may help tou.
Regards peter
Oorspronkelijk bericht
Van: direwyrmsg@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=nOXd_Wagw4p1LqhzoPdN_rpeEpbZJGZa9SxlwTa3_rH4Ej2AmajXj6hkRMekbzh6bz9LBViI4Qstd7tSGMNnJA]direwyrmsg@y...[/url
Verzonden: maandag 26 november 2001 20:50
Aan: basicstamps@yahoogroups.com
Onderwerp: [noparse][[/noparse]basicstamps] reducing unit time of pause command
Hello,
is it possible to reduce the unit time of 1ms for the PAUSE command?
I'm working on a project that requires me to send square pulses with
a max period of 1ms, 50% duty cycle. And it seems I can't do that
with the Basic Stamp.... or is it possible?
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I would try something like this.
Delay var word
cycles var word
High pin
For cycles=0 to 20 'number of wanted pulses
Pulse pin,250 '250 * 2 microsecs = 0.5 millisecs low period
For delay=0 to 50000
Next
Next
You must tweak the upper delay value to reach 50% dutycycle.
Use the binary method (dividing by two, adding a quarter etc.)
You may also want to change default rest state (here high)
Regards peter
Oorspronkelijk bericht
Van: direwyrmsg@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=K9BbWgC6IcYWEO5tdVGxjLe8CCEVA1W5NZ40VBUDJXtVzgJ6nxFher0WxpxOIIrmqOYV5sBMbv9EPyJC6dVCed8]direwyrmsg@y...[/url
Verzonden: dinsdag 27 november 2001 2:14
Aan: basicstamps@yahoogroups.com
Onderwerp: [noparse][[/noparse]basicstamps] Re: reducing unit time of pause command
Hmm....I'll try and see what happens.
question: i should be able to set the PULSOUT command to give a pulse
of 0.5ms, but how do I get the low signal of 0V to stay for 0.5 ms.
The minimum I can wait is 1ms with the PAUSE command.
The pulse signal I need is 0.5ms 5V square pulse / 0.5ms 0V cycle.
--- In basicstamps@y..., "peter verkaik" <peterverkaik@b...> wrote:
> Hi,
>
> How about the pulsout command used in a loop?
> That may help tou.
>
> Regards peter
>
>
>
Oorspronkelijk bericht
> Van: direwyrmsg@y... [noparse][[/noparse]mailto:direwyrmsg@y...]
> Verzonden: maandag 26 november 2001 20:50
> Aan: basicstamps@y...
> Onderwerp: [noparse][[/noparse]basicstamps] reducing unit time of pause command
>
> Hello,
> is it possible to reduce the unit time of 1ms for the PAUSE command?
> I'm working on a project that requires me to send square pulses with
> a max period of 1ms, 50% duty cycle. And it seems I can't do that
> with the Basic Stamp.... or is it possible?
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@y...
> from the same email address that you subscribed. Text in the
Subject and
> Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
If you cannot easily measure the dutycycle but you are able to measure the
output frequency
You can use this that guarantees 50% dutycycle.
Delay var word
Cycles var word
High pin
For cycles =0 to 20
Low pin
For delay=0 to 50000
'add dummy statements if the for-next loop is too fast
Next
High pin
For delay=0 to 50000
'identical dummy statements
Next
Next
Keep the two upperlimits for delay the same and tweak the value
Until you measure a 1kHz frquency.
Regards peter
Timing data on...
loop:
toggle 13
goto loop
This generates a square wave output frequency on P13, empirical
results as follows for different stamps:
frequency,khz period,millisecond
BS2 or BS2e: 1.110 0.901
BS2pe: 1.140 0.877
BS2sx: 2.764 0.362
BS2p: 2.847 0.351
(The BS2pe is like the BS2p, but clocked at 8 mhz instead of 20mhz
for low power.)
Timing data on a for-next loop...
i var word
loop:
for i=0 to 65534
toggle 13
next
goto loop
This too generates a frequency output, slower because of the for-next
overhead as follows:
frequency,khz period,millisecond
BS2 or BS2e: 0.519 1.928
BS2pe: 0.684 1.462
BS2sx: 1.291 0.774
BS2p: 1.707 0.586
The times are a a few microseconds faster if logical pins 0,1,2,4 or
8 are used, because of more efficient way the tokens for the power of
2 are stored in the program eeprom.
-- regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...