If you're doing it with software polling, timers don't add much value unless you plan on doing other things at the same time. But all that really makes things complicated.
So here's a simple example that does the same thing with pauseus instead of a timer.
Code:
Delay = 1000
Wait4Pulse:
IF !PORTA.0 THEN Wait4Pulse ; Wait for incoming pulse
PORTA.1 = 1 ; Start Output pulse
PAUSEUS Delay ; pause for pulse width
PORTA.1 = 0 ; End of Output pulse
Wait4PulseEnd: ; Make sure input pulse is finished
IF PORTA.0 THEN Wait4PulseEnd
GOTO Wait4Pulse
Bookmarks