Professional Documents
Culture Documents
Org
00h
Goto Main
Org
04h
Goto ISR
ISR:
//store w in temporary_reg
Movf status
Movwfstatus_temp
temporary_temp
//store status in
Movf pclath
Movwfpclath_temp
temporary_temp
Bcf
intcon,TMR0IF
//store pclath in
//clear TMR0IF flag
Comf portA
//complement of portA
Movf pclath_temp
//store pclath
Movwfpclath
Movf status_temp
//store status
Movwfstatus
Movf w_temp
//store W
Bcf
status,rp1
//select bank0
Bcf
status,rp0
Movlw 06h
//initialize TMR0=06h
MovwfTMR0
Bsf
Retfie
Main:
intcon,GIE
//enable GIE
//return from interrupt
//main program start
Bcf
status,rp1
Bcf
status,rp0
Clrf
portA
//select bank0
//clear portA
Movlw 06h
Movwftmr0
//TMR0=06h
Bcf
status,rp1
//select bank1
Bsf
status,rp0
Clrf
trisA
//clear trisA
Movlw 41h
to TMR0
Movwfoption
Movlw A0h
//enable T0IE,GIE
Movwfintcon
Bcf
status,rp1
Bcf
status,rp0
//select bank0
Movlw 00h
MovwfportA
Mloop:
end
goto
//set portA=00h
mloop
//loop