DELAY1 EQU 0x20
DELAY2 EQU 0x21
DELAY3 EQU 0x22
start:
ORG 0x00
#INCLUDE "P16F877A.INC"
__CONFIG _WDT_OFF
main:
BSF 0X03,5
MOVLW B'00000000'
MOVWF 0X86
MOVWF 0x89
red:
BCF 0x03,5
MOVLW B'00000001'
MOVWF 0x06
MOVLW B'00000100'
MOVWF 0x09
CALL delay
yellow:
RLF 0x06,F
RRF 0x09,F
CALL delay
green:
RLF 0x06,F
RRF 0x09,F
CALL delay
GOTO fin
delay:
MOVLW D'50'
MOVWF DELAY1
loop1: DECFSZ DELAY1,F
GOTO loop1
MOVWF DELAY
loop2: DECFSZ DELAY2,F
GOTO loop2
MOVWF DELAY3
loop3: DECFSZ DELAY3,F
GOTO loop3
RETURN
fin GOTO red
END