Datasheet

PICkit™ 3 DEBUG EXPRESS
© 2009 Microchip Technology Inc. DS41370C-page 9
Chapter 2. PIC18FXXXX Microcontroller Architectural
Overview
This section provides a simple overview of the PIC18FXXXX microcontroller
architecture.
2.1 MEMORY ORGANIZATION
The PIC18FXXXX microcontrollers are Harvard architecture microprocessors, mean-
ing that program memory and data memory are in separate spaces. This allows faster
execution as the program and data busses are separate and dedicated, so one bus
does not have to be used for both memory types. The return address stack also has its
own dedicated memory.
2.2 PROGRAM MEMORY
The program memory space is addressed by a 21-bit Program Counter (PC), allowing
a 2 Mb program memory space. Typically, PIC18FXXXX microcontrollers have on-chip
program memory in the range of 4K to 128 Kbytes. Some devices allow external
memory expansion.
At Reset, the PC is set to zero and the first instruction is fetched. Interrupt vectors are
at locations 0x000008 and 0x000018, so a GOTO instruction is usually placed at
address zero to jump over the interrupt vectors.
Most instructions are 16 bits, but some are double word 32-bit instructions. Instructions
cannot be executed on odd numbered bytes.
These are some important characteristics of the PIC18C architecture and MPLAB C
Compiler capabilities with reference to program memory:
MPLAB C Compiler Implementation
Refer to the “MPLAB C18 C Compiler User’s Guide” (DS51288) for more information
on these features.
Instructions are typically stored in program memory with the section attribute
code.
Data can be stored in program memory with the section attribute romdata in con-
junction with the rom keyword.
MPLAB C Compiler can be configured to generate code for two memory models,
small and large. When using the small memory model, pointers to program mem-
ory use 16 bits. The large model uses 24-bit pointers.
PIC18 Architecture
In some PIC18XXXX devices, program memory or portions of program memory can be
code-protected. Code will execute properly but it cannot be read out or copied.
Program memory can be read using table read instructions, and can be written through
a special code sequence using the table write instruction.