Command counter
The instruction counter , also program counter ( English program counter , shortly PC ), is a special register within a main processor which, depending on system architecture , the memory address of the current or the next to be executed command contains. Since this counter thus to a memory area shows , it is also called instruction pointer (English instruction pointer just IP ) or program pointer called.
details
If an instruction has been executed successfully, the main processor continues in the instruction sequence of the program : The main processor reads the next instruction from the memory address specified in the program step counter, increases the counter and executes the instruction (see Von Neumann cycle ).
If this is a jump command , the pointer is set according to the (explicitly or implicitly) specified jump address . In the event of a jump with the intention of returning (e.g. calling a subroutine or an interrupt handling routine ), the program step counter is saved in a specific register, at a defined location in the main memory or, in most modern processor families , on the return stack and processing is continued at the entry address of the subroutine. After the subroutine has ended, the program step counter is reset to the previous value (for example from the return stack) within a return command, so that execution continues at the original position of the "interrupted" program.
Single receipts
- ↑ a b Manual PIC24 / dsPIC-Mikrocontroller: Practical examples for the application of the modules and commands - Franzis-Verlag , 2014, ISBN 3-645-65273-6 ; See also in the Google book search in section 1.3.1: Addressing the program memory , once with 'program counter' and once again with "program pointer "