Hi Russ,
Something like below could work for you but it is just an example to show the idea.
Same concept could be applied to a Timer module of the PIC.
Code:
DEFINE OSC 20
TRISB = %00000000
PORTB = 0
Relay1 VAR PORTB.0 'A relay is driven through PORTB.0
Relay2 VAR PORTB.1
Relay3 VAR PORTB.2
RUSS_Timer var word 'A timer variable
RUSS_Match var word 'A variable to match timer with stored variables in Lookdown Table.
Begin:
Russ_Timer = 0
RUSS_Match = 0
Start:
PAUSE 100 'You need 100ms of time intervals.
RUSS_Timer = Russ_Timer + 1
LOOKDOWN RUSS_Timer ,[34,46,49,112,119,122,123,124,156,189,205,235],RUSS_Match 'Get an index value from the timer. Ad d more...
BRANCHL RUSS_Match, [Run_RED, Run_Green, Run_Blue, Run_last] 'Go run the matching set of instructions. Add more....
goto start
Run_Red:
high relay1
goto start
Run_Green:
high relay2
low relay1
goto start
Run_Blue:
TOGGLE relay3
low relay2
goto start
Run_Last:
PORTB = 0
goto begin 'Reset All.
END
Bookmarks