Review Questions 1. What is program counter? 2. Write a note on PIC18 Program Counter. 3. Explain the programmable ROM space in PIC18. 4. Draw and explain programmable memory map of PIC microcontroller 5. Explain programmable memory organization of PIC18FXXX microcontroller
Program and Data Memory Organization
•
A program counter is a register in a CPU that contains the address (location)
of the instruction being executed at the current time. After each instruction
is fetched, the program counter is incremented to point to the next instruction
in the sequence.
•
The PC can be accessed/modified by jump and branch instructions. Therefore, the
destination address can be loaded to the program counter via branch
instructions.
•
The width of the program counter decides how many memory locations CPU can
access. More the width, more the memory locations CPU can access.
•
Table 18.6.1 shows the width of program counter in various PIC families and
code memory access by them.
•
Fig. 18.6.1 shows the 21 bit program counter in PIC18 Family. The first
location of. program memory in PIC has the address of 00000H; however the last
location can be different depending on the size of the ROM on the chip.
•
Program Counter (PC) - 21-bit register that holds the program memory address
while executing programs. This means that the PIC18 family can access program
addresses 000000 to 1FFFFFH, a total of 2M bytes of code.
Table
18.6.2 shows the code memory (ROM) size for various PIC18 family members.
•
Fig. 18.6.2 shows program ROM space for PIC18F458 and PIC18F8722. As shown in
Fig. 18.6.2, the Reset vector address is at 0000h and the interrupt vector
addresses are at 0008h and 0018h.
•
The PIC18F458 has 32 kbytes of flash program memory. This translates into 32768
single-word instructions, which can be stored in the program memory.
•
On the other hand, the PIC18F8722 has 128 kbytes of Flash program memory. This
translates into 131072 single-word instructions, which can be stored in the
program memory.
•
Accessing a location between the physically implemented memory and the 2-Mbyte
address will cause a read of all '0's (a NOP instruction).
•
For the PIC18, the internal data bus between the code ROM and CPU is 16 bit.
Therefore, for PIC18F458, 32 kbyte code memory is presented as 16K x 16 memory.
As PIC18 family microcontrollers access 16 bits from a memory at given time,
all instructions of PIC18 are either 2 bytes or 4 bytes.
Review Questions
1. What is program
counter?
2. Write a note on
PIC18 Program Counter.
3. Explain the programmable
ROM space in PIC18.
4. Draw and explain
programmable memory map of PIC microcontroller
5. Explain
programmable memory organization of PIC18FXXX microcontroller
Microprocessors and Microcontrollers: Unit V: (b) Introduction to RISC Based Architecture : Tag: : - Program and Data Memory Organization