Using the mplab, C17 c compiler – Arizona Picdem 17 User Manual

Page 37

Advertising
background image

2001 Microchip Technology Inc.

DS39024B-page 31

Using the MPLAB

®

C17 C Compiler

;Save BSR and WREG

movfp BSR, PCLATH

clrf BSR, 1

movpf PCLATH, save_BSR

;Service the interrupt by calling the interrupt

;handling function

goto _TMR0_2

_TMR0_1

BANKSEL fpTMR0

movfp fpTMR0+1, PCLATH

movfp fpTMR0, PCL

_TMR0_2

call _TMR0_1 ; push address of next instruction on stack

;Restore WREG and BSR

clrf BSR, 1 ;BSR was saved in bank 0

movfp save_BSR, BSR ;Now restore it

movfp save_WREG, WREG ;and WREG as well.

;Restore PCLATH and ALUSTA

movfp save_PCLATH, PCLATH

movfp save_ALUSTA, ALUSTA

;Return from interrupt

RETFIE

;-----------------------------------------------------------;

;-----------------------------------------------------------;

_T0CKI_prolog

;Save BSR and WREG

movfp BSR, PCLATH

clrf BSR, 1

movpf PCLATH, save_BSR

;Service the interrupt by calling the interrupt

;handling function

goto _T0CKI_2

_T0CKI_1

BANKSEL fpT0CKI

movfp fpT0CKI+1, PCLATH

movfp fpT0CKI, PCL

_T0CKI_2

call _T0CKI_1 ; push address of next instruction on stack

;Restore WREG and BSR

clrf BSR, 1 ;BSR was saved in bank 0

movfp save_BSR, BSR ;Now restore it

movfp save_WREG, WREG ;and WREG as well.

;Restore PCLATH and ALUSTA

movfp save_PCLATH, PCLATH

movfp save_ALUSTA, ALUSTA

;Return from interrupt

RETFIE

;-----------------------------------------------------------;

Advertising