DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

PIC16F83-04/SO View Datasheet(PDF) - Microchip Technology

Part Name
Description
Manufacturer
PIC16F83-04/SO
Microchip
Microchip Technology 
PIC16F83-04/SO Datasheet PDF : 124 Pages
First Prev 41 42 43 44 45 46 47 48 49 50 Next Last
PIC16F8X
8.10 Context Saving During Interrupts
During an interrupt, only the return PC value is saved
on the stack. Typically, users wish to save key register
values during an interrupt (e.g., W register and STATUS
register). This is implemented in software.
Example 8-1 stores and restores the STATUS and W
register’s values. The User defined registers, W_TEMP
and STATUS_TEMP are the temporary storage
locations for the W and STATUS registers values.
Example 8-1 does the following:
a) Stores the W register.
b) Stores the STATUS register in STATUS_TEMP.
c) Executes the Interrupt Service Routine code.
d) Restores the STATUS (and bank select bit)
register.
e) Restores the W register.
EXAMPLE 8-1: SAVING STATUS AND W REGISTERS IN RAM
PUSH
ISR
POP
MOVWF
SWAPF
MOVWF
:
:
:
:
SWAPF
MOVWF
SWAPF
SWAPF
W_TEMP
STATUS, W
STATUS_TEMP
STATUS_TEMP, W
STATUS
W_TEMP, F
W_TEMP, W
; Copy W to TEMP register,
; Swap status to be saved into W
; Save status to STATUS_TEMP register
:
; Interrupt Service Routine
; should configure Bank as required
;
; Swap nibbles in STATUS_TEMP register
; and place result into W
; Move W into STATUS register
; (sets bank to original state)
; Swap nibbles in W_TEMP and place result in W_TEMP
; Swap nibbles in W_TEMP and place result into W
© 1998 Microchip Technology Inc.
DS30430C-page 49

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]