PIC® MCU Architecture
2012 Microchip Technology Inc. DS41628B-page 25
2.10 STACK LEVEL
The PIC18 has a deeper stack level of 31, whereas the enhanced core has 16. A
deeper stack allows the PIC device to make more calls in the software before returning
to the original address where the first call was made.
A call or goto modifies the program counter to point to a different place in code. With-
out these, the code would execute from the top to the bottom. The lessons will show
the significance of this.
The call stack is used to save the return address before going to a new position in
program memory.
As a frame of reference, some of the baseline parts (PIC10/12) devices have a call
stack that is only two levels deep. It is quite a challenge to create modular code with a
limited stack depth.
2.11 MEMORY ORGANIZATION
There are three sections of memory in the PIC16 enhanced mid-range and PIC18
devices:
1. Program Memory
2. Data RAM
3. Data EEPROM
2.12 PROGRAM MEMORY
There are five sections of program memory:
1. Flash Program Memory
2. Configuration Words
3. Device ID
4. Revision ID
5. User ID
2.12.1 Flash Program Memory
All enhanced mid-range and PIC18 devices use Flash memory for programming. Flash
allows the PIC device to be erased and written to hundreds of thousands of times.
2.12.2 Configuration Words
There are several Configuration Word bits, or fuses, that allow different configurations
at run-time. Oscillator selections, memory protection, low-voltage detection, etc., are
some examples of configuration options. Each device has different configuration
options. Enhanced mid-range Configuration bits are read-only during code execution.
PIC18 can read all and write most Configuration bits during code execution. The
Configuration bits are programmed in a special way, as seen in the lesson source files.
2.12.3 Device ID
The Device ID contains the read-only manufacture’s ID for the PIC MCU. The
PIC16F1829 ID is stored in DEVICEID and the PIC18F14K22 is stored in DEVID1 and
DEVID2.