LIST p=16F877 R=DEC ; list directive to define processor
INCLUDE "P16F877.INC"
;-----------------------------
W_TEMP EQU 0x20
STATUS_TEMP EQU 0x21
BlankCet EQU 0x22
Scalerr EQU 0x23
Scalerg EQU 0x24
Scalerb EQU 0x25
MaxCount EQU 0x26
TTEE EQU 0x27
;-----------------------------
org 0x00
nop
goto MainLine
org 0x04
goto IntService
;-----------------------------
Timer1
banksel PIR1
bcf PIR1,TMR1IF
banksel TTEE
btfss TTEE,0
decfsz Scalerr ;
goto tim1 ;
bsf TTEE,0 ;
tim1
btfss TTEE,1
decfsz Scalerg ;
goto tim2 ;
bsf TTEE,1 ;
tim2
btfss TTEE,2
decfsz Scalerb ;
goto tim3 ;
bsf TTEE,2 ;
tim3
clrf TMR1L
movlw 0xf8
movwf TMR1H
movlw 0x2f
movwf TMR1L
return
;-----------------------------
MainLine
Call Initial
MainLoop
clrf PORTA
abc
call LEDOFF
btfsc PORTC,0
goto abc
btfsc PORTC,1
goto abc
btfsc PORTC,2
goto abc
goto MainLoop
;-----------------------------
Initial
banksel TTEE
clrf TTEE
movwf BlankCnt
movlw 0x40
movwf Scalerr
movlw 0x50
movwf Scalerg
movlw 0x60
movwf Scalerb
banksel TRISC
clrf TRISC
banksel T1CON
clrf T1CON
clrf TMR1H
clrf TMR1L
clrf INTCON
bsf INTCON,PEIE
banksel PIE1
clrf PIE1
bsf PIE1,TMR1IE
banksel PIR1
clrf PIR1
banksel TMR1L
clrf TMR1L
movlw 0xf8
movwf TMR1H
movlw 0x2f
bsf T1CON,TMR1ON
banksel INTCON
bsf INTCON,GIE
return
;------------------------------
IntService
movwf W_Temp
swapf STATUS,W
movwf STATUS_Temp
btfsc PIR1,TMR1IF
call Timer1
swapf STATUS_Temp
movwf STATUS
swapf W_Temp,f
swapf W_Temp,w
retfie
;------------------------------
LEDOFF
btfsc TTEE,0
bsf PORTC,0 ;=1
btfsc TTEE,1 ;=0
bsf PORTC,1
btfsc TTEE,2
bsf PORTC,2
return
;------------------------------
END
compiler一直不會過請各位幫我看看 謝謝唷^^