Fastest way to start a program after a falling edge
Direct Digital Labs
Posts: 27
Is there a faster way to execute code after any falling edge in ASM ? ·
This is what I came up with.
-TRC
This is what I came up with.
[color=#000000]Step1: ;Loop until Low[/color] [color=#000000] SNB RA.0 ;1 cycle (2 if skip)[/color] [color=#000000] JMP Step3 ;3 cycles[/color] [color=#000000] JMP Step2 ;3 cycles[/color] [color=#000000]Step2: ;Loop until High[/color] [color=#000000] SB RA.0 ;1 cycle (2 if skip)[/color] [color=#000000] JMP Step2 ;3 cycles[/color] [color=#000000] JMP Step3 ;3 cycles[/color] [color=#000000]Step3: ;Loop until Low[/color] [color=#000000] SNB RA.0 ;1 cycle (2 if skip)[/color] [color=#000000] JMP Step3 ;3 cycles[/color] [color=#000000] JMP @Main ;4 cycles (on another page) [/color]
-TRC
Comments
JNB RA.0,$
JB RA.0,$
JMP @Main
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Available now! Cheap 4-digit LED display with driver IC·www.hc4led.com
"I reject your reality, and substitute my own." Mythbusters
·
JB RA.0,· $
JNB RA.0,· $
JB RA.0,· $
(Main code here, no jump)
Nate
·
The code space is tight (very tight) so I had to spilt things up a bit. This is what I ended up with, which works fine·since there is 16 clock cycles·during the last high transition.
Thanks for your help!
-Dan-
Two cycles would be best case, 5 cycles worst case.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Available now! Cheap 4-digit LED display with driver IC·www.hc4led.com
"I reject your reality, and substitute my own." Mythbusters
·
worst case is 5 + intperiod cycles
regards peter
·