CHAPTER 4 INTERNAL CPU FUNCTION
62
User’s Manual U10676EJ3V0UM
4.2 Program Counter (PC) ··· 12 bits
This is a binary counter that holds an address of the program memory.
Figure 4-2. Configuration of Program Counter
PC11
PC10
PC9
PC8
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
The value of the program counter (PC) is usually automatically incremented by the number of bytes of an instruction
each time that instruction has been executed.
When a branch instruction (BR, BRA, or BRCB) is executed, immediate data indicating the branch destination
address or the contents of a register pair are loaded to all or some bits of the PC.
When a subroutine call instruction (CALL, CALLA, or CALLF) is executed or when a vector interrupt occurs, the
contents of the PC (a return address already incremented to fetch the next instruction) are saved to the stack memory
(data memory specified by the stack pointer). Then, the jump destination address is loaded to the PC.
When the return instruction (RET, RETS, or RETI) instruction is executed, the contents of the stack memory are
set to the PC.
When the RESET signal is asserted, the contents of the program counter (PC) are initialized to the contents of
address 0000H and 0001H of the program memory, and the program can be started from any address according to
the contents.
PC
11-8
←
(0000H)
3-0
, PC
7-0
←
(0001H)
7-0