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

PIC18F4431-I/P 参数 Datasheet PDF下载

PIC18F4431-I/P图片预览
型号: PIC18F4431-I/P
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚增强型闪存微控制器采用纳瓦技术,高性能PWM和A / D [28/40/44-Pin Enhanced Flash Microcontrollers with nanoWatt Technology, High-Performance PWM and A/D]
分类和应用: 闪存微控制器
文件页数/大小: 392 页 / 3127 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC18F4431-I/P的Datasheet PDF文件第64页浏览型号PIC18F4431-I/P的Datasheet PDF文件第65页浏览型号PIC18F4431-I/P的Datasheet PDF文件第66页浏览型号PIC18F4431-I/P的Datasheet PDF文件第67页浏览型号PIC18F4431-I/P的Datasheet PDF文件第69页浏览型号PIC18F4431-I/P的Datasheet PDF文件第70页浏览型号PIC18F4431-I/P的Datasheet PDF文件第71页浏览型号PIC18F4431-I/P的Datasheet PDF文件第72页  
PIC18F2331/2431/4331/4431  
6.5.1  
BANK SELECT REGISTER (BSR)  
6.5.2  
ACCESS BANK  
Large areas of data memory require an efficient  
addressing scheme to make rapid access to any  
address possible. Ideally, this means that an entire  
address does not need to be provided for each read or  
write operation. For PIC18 devices, this is accom-  
plished with a RAM banking scheme. This divides the  
memory space into 16 contiguous banks of 256 bytes.  
While the use of the BSR with an embedded 8-bit  
address allows users to address the entire range of  
data memory, it also means that the user must always  
ensure that the correct bank is selected; otherwise,  
data may be read from or written to the wrong location.  
This can be disastrous if a GPR is the intended target  
of an operation, but an SFR is written to instead.  
Verifying and/or changing the BSR for each read or  
write to data memory can become very inefficient.  
Depending on the instruction, each location can be  
addressed directly by its full 12-bit address, or an 8-bit  
low-order address and a four-bit Bank Pointer. Most  
instructions in the PIC18 instruction set make use of  
the Bank Pointer, known as the Bank Select Register  
(BSR). This SFR holds the four Most Significant bits of  
a location’s address; the instruction itself includes the  
eight Least Significant bits. Only the four lower bits of  
the BSR are implemented (BSR<3:0>). The upper four  
bits are unused; they will always read ‘0’ and cannot be  
written to. The BSR can be loaded directly by using the  
MOVLBinstruction.  
To streamline access for the most commonly used data  
memory locations, the data memory is configured with  
an Access Bank, which allows users to access a  
mapped block of memory without specifying a BSR.  
The Access Bank consists of the first 128 bytes of  
memory (00h-7Fh) in Bank 0 and the last 128 bytes of  
memory (80h-FFh) in Block 15. The lower half is known  
as the “Access RAM” and is composed of GPRs. This  
upper half is also where the device’s SFRs are  
mapped. These two areas are mapped contiguously in  
the Access Bank and can be addressed in a linear  
fashion by an 8-bit address (Figure 6-6).  
The value of the BSR indicates the bank in data mem-  
ory. The eight bits in the instruction show the location in  
the bank and can be thought of as an offset from the  
bank’s lower boundary. The relationship between the  
BSR’s value and the bank division in data memory is  
shown in Figure 6-6.  
The Access Bank is used by core PIC18 instructions  
that include the Access RAM bit (the ‘a’ parameter in  
the instruction). When ‘a’ is equal to ‘1’, the instruction  
uses the BSR and the 8-bit address included in the  
opcode for the data memory address. When ‘a’ is ‘0’,  
however, the instruction is forced to use the Access  
Bank address map; the current value of the BSR is  
ignored entirely.  
Since up to 16 registers may share the same low-order  
address, the user must always be careful to ensure that  
the proper bank is selected before performing a data  
read or write. For example, writing what should be pro-  
gram data to the eight-bit address of F9h, while the  
BSR is 0Fh, will end up resetting the program counter.  
Using this “forced” addressing allows the instruction to  
operate on a data address in a single cycle, without  
updating the BSR first. For 8-bit addresses of 80h and  
above, this means that users can evaluate and operate  
on SFRs more efficiently. The Access RAM below 80h  
is a good place for data values that the user might need  
to access rapidly, such as immediate computational  
results or common program variables. Access RAM  
also allows for faster and more code efficient context  
saving and switching of variables.  
While any bank can be selected, only those banks that  
are actually implemented can be read or written to.  
Writes to unimplemented banks are ignored, while  
reads from unimplemented banks will return ‘0’s. Even  
so, the STATUS register will still be affected as if the  
operation was successful. The data memory map in  
Figure 6-5 indicates which banks are implemented.  
In the core PIC18 instruction set, only the MOVFF  
instruction fully specifies the 12-bit address of the  
source and target registers. This instruction ignores the  
BSR completely when it executes. All other instructions  
include only the low-order address as an operand and  
must use either the BSR or the Access Bank to locate  
their target registers.  
6.5.3  
GENERAL PURPOSE REGISTER  
(GPR) FILE  
PIC18 devices may have banked memory in the GPR  
area. This is data RAM, which is available for use by all  
instructions. GPRs start at the bottom of Bank 0  
(address 000h) and grow upwards towards the bottom of  
the SFR area. GPRs are not initialized by a Power-on  
Reset and are unchanged on all other Resets.  
DS39616D-page 68  
2010 Microchip Technology Inc.  
 复制成功!