Last active
September 16, 2015 19:26
-
-
Save marioIncandeza/febf83284eafd78fb827 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORG 000H | |
GOTO INIT | |
ORG 004H | |
GOTO TMR0ISR | |
INIT | |
WCOPY EQU 70H ;Since the upper 16 bytes of all GPR banks are common in the PIC16F882/883/884/886/887, | |
STATCOPY EQU 71H ;temporary holding registers, W_TEMP and STATUS_TEMP, should be placed in here. | |
;These 16 locations do not require banking and therefore, make it easier to context save and restore. | |
BCF STATUS,RP1 | |
BSF STATUS,RP0 ;move to bank 1 where INTCON and OPTION_REG are | |
MOVLW b'1010 0000' | |
MOVWF INTCON | |
MOVLW b'0000 0110' | |
MOVWF OPTION_REG | |
GOTO MAIN | |
MAIN | |
NOP | |
NOP | |
NOP | |
GOTO MAIN | |
BCF STATUS,RP0 | |
MOVLW 0B2H | |
MOVWF TMR0 | |
TMR0ISR | |
MOVWF WCOPY | |
SWAPF STATUS,W | |
MOVWF STATCOPY | |
. | |
. | |
. | |
MOVLW 0B2H | |
MOVWF TMR0 | |
BCF INTCON,2 | |
SWAPF STATCOPY,W | |
MOVWF STATUS | |
SWAPF WCOPY,F | |
SWAPF WCOPY,W | |
RETFIE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment