Blink without the pause command
Hi All,
I want to blink a LED without the pause command because I want to do other things and not stop the entire loop every time the LED blinks.
For example, with the pause command the code looks like this:
main:
high portb.0
pause 500
low portb.0
pause 500
goto main
Without the pause command the code could look something like this:
count_on var byte
count_off var byte
pause_led var byte
count_on = 0
count_off = 0
pause_led = 5000
main:
if count_on = 0 then
high portb.0
endif
if count_on != pause_led
count_on = count_on + 1
endif
if count_on = pause_led then
low portb.0
count_off = count_off + 1
if count_off = pause_led then
count_on = 0
count_off = 0
endif
endif
goto main:
My question is, if I want to leave the LED turned on for 1 second, how many "if" cycles should I do?
Thanks!
Daniel.