Well, ok.
But I accept no responsibility for the resulting accidents.
Code:@ device INTOSCIO, WDT_OFF, PWRT_OFF, MCLR_OFF, PROTECT_OFF, CPD_OFF DEFINE OSCCAL_1K 1 Green CON 5000 ; mS to show Green Light Yellow CON 1000 ; mS to show Yellow Light Tcalibrate CON 480 ; Adjust for loop timing accuracy ;--------------------- Sequence VAR BYTE ; cycles through the 4 states TimeCount VAR WORD ; Counts down sequence time CMCON = 7 ; Disable comparator GPIO = %110000 ; Start with all LED's off TRISIO = %001000 ; Set LED ports to output ;--------------------------------------------------------------------------- Main: FOR Sequence = 0 to 3 LOOKUP2 Sequence,[ Green, Yellow, Green, Yellow], TimeCount REPEAT ; Multiplex LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ; Tr. Light #1 PauseUS Tcalibrate LOOKUP Sequence,[%010100,%010100,%010001,%010011],GPIO ; Tr. Light #2 PauseUS Tcalibrate TimeCount = TimeCount - 1 UNTIL TimeCount = 0 NEXT Sequence GOTO Main





Bookmarks