This last post made me to put on my thinking capI do this stuff within an ISR usually, but your case doesn't need it.
How about something like this. BEWARE : untested code
Code:Out1 var PORTB.0 Out2 var PORTB.1 Out3 var PORTB.2 AllOn con %00000111 ' all three outputs on Delay1 var word ' turn off delay for output1 Delay2 var word ' and 2 Delay3 var word ' surely this has to be for 3 RunDelay var word ' this is the running timer ' set all outputs on together TRISB = 0 Delay1 = 1000 ' in units of PAUSE time Delay2 = 2000 Delay3 = 3000 Loop: PORTB = AllOn for RunDelay = 0 to 65535 ' or whatever is the maximum you want ' this would be your cycle / repeat time if RunDelay > Delay1 then Out1 = 0 endif if RunDelay > Delay2 then Out2 = 0 endif if RunDelay > Delay3 then Out3 = 0 endif pauseus 10 ' this is the resolution of your delays next goto Loop


I do this stuff within an ISR usually, but your case doesn't need it.


Bookmarks