Square Wave pulses ?
Blackbird455
Posts: 124
1. Is there a way to produce square wave pulses with a BS1?
2. What type of wave does the pulsout command produce with a BS2?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
ETERNAL NOOB, you could learn alot from a dummy.......
"one should not profess ones ignorance, one should just read more books"
······························································ ......unknown
2. What type of wave does the pulsout command produce with a BS2?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
ETERNAL NOOB, you could learn alot from a dummy.......
"one should not profess ones ignorance, one should just read more books"
······························································ ......unknown
Comments
The reason for the two labels and two gotos is to balance the execution time in the two halves of the loop.
This example would produce the highest frequency square wave and the frequency would obviously depend
on the model of the Stamp being used. To slow it down, use a pause before each goto. That would get you
a square wave of approximately 500Hz (2ms in the pauses and some time on the order of 100's of us or less
for the statement execution time). You could also add statements other than a pause before the gotos to slow
down the loop, but you'd need to experiment to get just the delay you might need.
The BS1 and BS2 pulsout statements work essentially the same way except for the granularity of the pulse width.
You could use a pulsout statement to an otherwise unused pin to produce the delays needed in the above loop.
This would allow you to easily adjust the square wave frequency by varying the pulsout pulse width, yet give you
a symmetric square wave.
Post Edited (Mike Green) : 9/21/2007 4:51:59 AM GMT
high thepin
do
toggle thepin
loop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun
TR
Post Edited (TechnoRobbo) : 9/21/2007 9:12:02 PM GMT
Is that what I am doing when I toggle the pin high,
for reps 1-30
toggle 2
pause 16
that basically switches it high 30 times with a 16ms pause high and 16ms low right?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Noli nothis permittere te terere
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Noli nothis permittere te terere
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Noli nothis permittere te terere
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I know what I know, don't confuse me with the facts...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·