11.1.1 Program Counter
The Program Counter (PC) specifies the address of the instruction to fetch for execution. The PC is 21 bits wide and is contained in three separate 8-bit registers. The low byte, known as the PCL register, is both readable and writable. The high byte, or PCH register, contains the PC[15:8] bits; it is not directly readable or writable. Updates to the PCH register are performed through the PCLATH register. The upper byte is called PCU. This register contains the PC[20:16] bits; it is also not directly readable or writable. Updates to the PCU register are performed through the PCLATU register.
The contents of PCLATH and PCLATU are transferred to the Program
Counter by any operation that writes PCL. Similarly, the upper two bytes of the Program
Counter are transferred to PCLATH and PCLATU by an operation that reads PCL. This is useful
for computed offsets to the PC (see Computed GOTO
).
The PC addresses bytes in the program memory. To prevent the PC from
becoming misaligned with word instructions, the Least Significant bit of PCL is fixed to a
value of ‘0
’. The PC increments by two to address sequential instructions
in the program memory.
The CALL
, RCALL
, GOTO
and
program branch instructions write to the Program Counter directly. For these instructions,
the contents of PCLATH and PCLATU are not transferred to the Program Counter.