SECTION II-5: File Register and Access bank in the PIC18

The file register of the PIC18 family can have a maximum of 4096 (4K) bytes. With 4096 bytes, the file register has addresses of 000-FFFH. The file register in the PIC18 is divided into 256 byte banks. We can have up to a maximum of 16 banks (16 X 256 = 4096). Although not all members of the PIC18 family have that many banks, every PIC18 family member has at least one bank for the file register. This bank is called the access bank and is the default bank when we power up the PIC18 chip.


File Register for PIC18 Family


We concentrate on the PIC18 series with their large file register, although the insight gained in the process can be applied to the PIC16 and PIC12 series.

Examine the access bank for the PIC18 in figure below. The 256 byte access bank is divided into two equal sections of 128 bytes. These 128 bytes sections are given to the general purpose registers and special function registers. The 128 bytes from locations 00H to 7FH are set aside for general purpose registers and are used for read / write storage, or what is normally called scratch pad. These 128 locations of RAM are widely used for storing data and parameters by PIC18 programmers and C compilers. Each location of this 128 byte RAM of general purpose registers can be accessed directly by its address. We will use these locations in future chapters to store data brought into the CPU via I / O and serial ports. Will also use then to define counters for time delay. The other 128 bytes of the access bank is used for special function registers. It has addresses of F80H to FFFH. Why the memory space of the SFRs and GPRs in the access bank is not contiguous?. The reason is to allow the RAM space between 080H and F7FH to be used for the general purpose registers GPRs by various members of the PIC18 if they implement a larger data RAM size for the file register. A file register of more than 256 bytes will necessitate bank switching. Bank switching is a method used to access all the banks of the file register for PIC18 family members that have more than the minimum access bank. PIC18 members with a file register of more than 256 bytes will be discussed, when we discuss bank switching.

The I / O port SFRs, PORTA, PORTB, PORTC, PORTD, and associated registers are among the most widely used special function registers in PIC.

More From