assembly code query
kenmac
Posts: 96
Hi folks,
I'm playing with some simple assembly code found in the Manual.
The following code operates correctly and toggles a pin at a set rate:
However, if the toggle action occurs before the delay, as in the following, it doesn't work - it just sets the pin high continuously.
Why doesn't the second version work?
The code is part of assemblytoggle.spin in page 340 of the manual.
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
I'm playing with some simple assembly code found in the Manual.
The following code operates correctly and toggles a pin at a set rate:
:loop waitcnt Time, Delay 'Wait xor outa, Pin 'Toggle Pin jmp #:loop 'Loop endlessly
However, if the toggle action occurs before the delay, as in the following, it doesn't work - it just sets the pin high continuously.
:loop xor outa, Pin 'Toggle Pin waitcnt Time, Delay 'Wait jmp #:loop 'Loop endlessly
Why doesn't the second version work?
The code is part of assemblytoggle.spin in page 340 of the manual.
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
Post Edited (Ken Peterson) : 10/1/2008 4:46:47 PM GMT