欢迎访问ic37.com |
会员登录 免费注册
发布采购

PIC18F2320-I/SP 参数 Datasheet PDF下载

PIC18F2320-I/SP图片预览
型号: PIC18F2320-I/SP
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚高性能,增强型闪存微控制器与10位A / D和纳瓦技术 [28/40/44-Pin High-Performance, Enhanced Flash Microcontrollers with 10-Bit A/D and nanoWatt Technology]
分类和应用: 闪存微控制器和处理器外围集成电路光电二极管PC时钟
文件页数/大小: 388 页 / 6899 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC18F2320-I/SP的Datasheet PDF文件第54页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第55页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第56页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第57页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第59页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第60页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第61页浏览型号PIC18F2320-I/SP的Datasheet PDF文件第62页  
PIC18F2220/2320/4220/4320  
5.3  
Fast Register Stack  
5.4  
PCL, PCLATH and PCLATU  
A “fast return” option is available for interrupts. A Fast  
Register Stack is provided for the Status, WREG and  
BSR registers and are only one in depth. The stack is  
not readable or writable and is loaded with the current  
value of the corresponding register when the processor  
vectors for an interrupt. The values in the registers are  
then loaded back into the working registers if the  
RETFIE, FASTinstruction is used to return from the  
interrupt.  
The Program Counter (PC) specifies the address of the  
instruction to fetch for execution. The PC is 21-bits  
wide. The low byte, known as the PCL register, is both  
readable and writable. The high byte, or PCH register,  
contains the PC<15:8> bits and is not directly readable  
or writable. Updates to the PCH register may be per-  
formed through the PCLATH register. The upper byte is  
called PCU. This register contains the PC<20:16> bits  
and is not directly readable or writable. Updates to the  
PCU register may be performed through the PCLATU  
register.  
All interrupt sources will push values into the stack reg-  
isters. If both low and high priority interrupts are  
enabled, the stack registers cannot be used reliably to  
return from low priority interrupts. If a high priority inter-  
rupt occurs while servicing a low priority interrupt, the  
stack register values stored by the low priority interrupt  
will be overwritten. Users must save the key registers  
in software during a low priority interrupt.  
The contents of PCLATH and PCLATU will be trans-  
ferred to the program counter by any operation that  
writes PCL. Similarly, the upper two bytes of the pro-  
gram counter will be transferred to PCLATH and  
PCLATU by an operation that reads PCL. This is useful  
for computed offsets to the PC (see Section 5.8.1  
“Computed GOTO).  
If interrupt priority is not used, all interrupts may use the  
Fast Register Stack for returns from interrupt.  
The PC addresses bytes in the program memory. To  
prevent the PC from becoming misaligned with word  
instructions, the LSB of PCL is fixed to a value of ‘0’.  
The PC increments by 2 to address sequential  
instructions in the program memory.  
If no interrupts are used, the Fast Register Stack can be  
used to restore the Status, WREG and BSR registers at  
the end of a subroutine call. To use the Fast Register  
Stack for a subroutine call, a CALL label, FAST  
instruction must be executed to save the Status,  
WREG and BSR registers to the Fast Register Stack. A  
RETURN, FASTinstruction is then executed to restore  
these registers from the Fast Register Stack.  
The CALL, RCALL, GOTO and program branch  
instructions write to the program counter directly. For  
these instructions, the contents of PCLATH and  
PCLATU are not transferred to the program counter.  
Example 5-1 shows a source code example that uses  
the Fast Register Stack during a subroutine call and  
return.  
EXAMPLE 5-1:  
FAST REGISTER STACK  
CODE EXAMPLE  
CALL SUB1, FAST  
;STATUS, WREG, BSR  
;SAVED IN FAST REGISTER  
;STACK  
SUB1  
RETURN FAST  
;RESTORE VALUES SAVED  
;IN FAST REGISTER STACK  
DS39599C-page 56  
2003 Microchip Technology Inc.  
 复制成功!