#include p16f1823.inc
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LVP_OFF
errorlevel 0,-302
ORG 0000H
GOTO START
ORG 0004H
BANKSEL IOCAF
CLRF IOCAF
BANKSEL TOSH
CLRF TOSH
MOVLW 10H
MOVWF TOSL
RETFIE
INTPP ORG 0010H
BCF PORTC,0
DELAY2;延时程序,蓝灯闪
MOVLW 0F0H
MOVWF 75H
CLRF 74H
INCFSZ 74H,F
GOTO $-1
DECFSZ 75H,F
GOTO $-3
BTFSS 73H,1
GOTO $+4
BSF PORTC,1
BCF 73H,1
GOTO DELAY2
BCF PORTC,1
BSF 73H,1
GOTO DELAY2
START ORG 0040H
BANKSEL TRISC;初始化
BCF TRISC,0
BCF TRISC,1
BANKSEL PORTC
BCF PORTC,0
BCF PORTC,1
BANKSEL ANSELA
BCF ANSELA,4
BANKSEL IOCAF
CLRF IOCAF
MOVLW B'10001000'
MOVWF INTCON
BANKSEL IOCAN
BSF IOCAN,4
DELAY1;延时程序,黄灯闪
BANKSEL PORTC
MOVLW 0F0H
MOVWF 72H
CLRF 71H
INCFSZ 71H,F
GOTO $-1
DECFSZ 72H,F
GOTO $-3
BTFSS 73H,0
GOTO $+4
BSF PORTC,0
BCF 73H,0
GOTO DELAY1
BCF PORTC,0
BSF 73H,0
GOTO DELAY1
END |