Embedded Systems
23
Program Counter
The Program Counter is a 16- or 32-bit register which contains the address of the next instruction
to be executed. The PC automatically increments to the next sequential memory location every
time an instruction is fetched. Branch, jump, and interrupt operations load the Program Counter
with an address other than the next sequential location.
Activating a power-on reset will cause all values in the register to be lost. It means the value of
the PC (program counter) is 0 upon reset, forcing the CPU to fetch the first opcode from the
ROM memory location 0000. It means we must place the first byte of upcode in ROM location
0000 because that is where the CPU expects to find the first instruction.
Reset Vector
The significance of the reset vector is that it points the processor to the memory address which
contains the firmware's first instruction. Without the Reset Vector, the processor would not know
where to begin execution. Upon reset, the processor loads the Program Counter (PC) with the
reset vector value from a predefined memory location. On CPU08 architecture, this is at location
$FFFE:$FFFF.
When the
reset vector is not necessary, developers normally take it for granted and don’t
program into the final image. As a result, the processor doesn't start up on the final product. It
is a common mistake that takes place during the debug phase.
Do'stlaringiz bilan baham: