PIC16F8X
DS30430C-page 50
1998 Microchip Technology Inc.
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
MOVWF
W_TEMP
; Copy W to TEMP register,
SWAPF
STATUS, W
; Swap status to be saved into W
MOVWF
STATUS_TEMP
; Save status to STATUS_TEMP register
ISR
:
; Interrupt Service Routine
:
;
should configure Bank as required
:
;
POP
SWAPF
STATUS_TEMP, W
; Swap nibbles in STATUS_TEMP register
; and place result into W
MOVWF
STATUS
; Move W into STATUS register
;
(sets bank to original state)
SWAPF
W_TEMP, F
; Swap nibbles in W_TEMP and place result in W_TEMP
SWAPF
W_TEMP, W
; Swap nibbles in W_TEMP and place result into W
相關(guān)PDF資料
PDF描述
PIC18LF452-I/ML IC MCU FLASH 16KX16 A/D 44QFN
PIC18LF4520-I/ML IC MCU FLASH 16KX16 44QFN
PIC18LF4523-I/ML IC PIC MCU FLASH 16KX16 44QFN
PIC18LF4550-I/ML IC PIC MCU FLASH 16KX16 44QFN
PIC18LF458-I/PT IC MCU CAN FLASH 16K LP 44-TQFP
相關(guān)代理商/技術(shù)參數(shù)
參數(shù)描述
PIC18LF44J10T-I/ML 功能描述:8位微控制器 -MCU 16 KB FL 1024 RAM RoHS:否 制造商:Silicon Labs 核心:8051 處理器系列:C8051F39x 數(shù)據(jù)總線寬度:8 bit 最大時(shí)鐘頻率:50 MHz 程序存儲(chǔ)器大小:16 KB 數(shù)據(jù) RAM 大小:1 KB 片上 ADC:Yes 工作電源電壓:1.8 V to 3.6 V 工作溫度范圍:- 40 C to + 105 C 封裝 / 箱體:QFN-20 安裝風(fēng)格:SMD/SMT
PIC18LF44J10T-I/PT 功能描述:8位微控制器 -MCU 16 KB FL 1024 RAM RoHS:否 制造商:Silicon Labs 核心:8051 處理器系列:C8051F39x 數(shù)據(jù)總線寬度:8 bit 最大時(shí)鐘頻率:50 MHz 程序存儲(chǔ)器大小:16 KB 數(shù)據(jù) RAM 大小:1 KB 片上 ADC:Yes 工作電源電壓:1.8 V to 3.6 V 工作溫度范圍:- 40 C to + 105 C 封裝 / 箱體:QFN-20 安裝風(fēng)格:SMD/SMT
PIC18LF44J11-I/ML 功能描述:8位微控制器 -MCU 16KB Flash 4KBRAM 12MIPS nanoWatt RoHS:否 制造商:Silicon Labs 核心:8051 處理器系列:C8051F39x 數(shù)據(jù)總線寬度:8 bit 最大時(shí)鐘頻率:50 MHz 程序存儲(chǔ)器大小:16 KB 數(shù)據(jù) RAM 大小:1 KB 片上 ADC:Yes 工作電源電壓:1.8 V to 3.6 V 工作溫度范圍:- 40 C to + 105 C 封裝 / 箱體:QFN-20 安裝風(fēng)格:SMD/SMT
PIC18LF44J11-I/PT 功能描述:8位微控制器 -MCU 16KB Flash 4KBRAM 12MIPS nanoWatt RoHS:否 制造商:Silicon Labs 核心:8051 處理器系列:C8051F39x 數(shù)據(jù)總線寬度:8 bit 最大時(shí)鐘頻率:50 MHz 程序存儲(chǔ)器大小:16 KB 數(shù)據(jù) RAM 大小:1 KB 片上 ADC:Yes 工作電源電壓:1.8 V to 3.6 V 工作溫度范圍:- 40 C to + 105 C 封裝 / 箱體:QFN-20 安裝風(fēng)格:SMD/SMT
PIC18LF44J11T-I/ML 功能描述:8位微控制器 -MCU 16KB Flash 4KBRAM 12MIPS nanoWatt RoHS:否 制造商:Silicon Labs 核心:8051 處理器系列:C8051F39x 數(shù)據(jù)總線寬度:8 bit 最大時(shí)鐘頻率:50 MHz 程序存儲(chǔ)器大小:16 KB 數(shù)據(jù) RAM 大小:1 KB 片上 ADC:Yes 工作電源電壓:1.8 V to 3.6 V 工作溫度范圍:- 40 C to + 105 C 封裝 / 箱體:QFN-20 安裝風(fēng)格:SMD/SMT