4. Program Counter

special registers in a cpu

 

The Program Counter holds the address in memory of the next instruction.

For example if the program counter has the address 305 then the next instruction will be at location 305 in main memory (RAM). When a program is running, the program counter will often just be incrementing as it addresses one instruction after the other, e.g. 305, 306, 307. However, the program will often modify the next address, for example, 305 becomes 39.

What has happened is called a 'jump instruction'. This is how the software programmer will cause different parts of their code to run depending on some condition e.g. a conditional IF statement.

It is also how an interrupt routine is serviced. The program counter will be loaded with the starting address of the interrupt routine.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Best basic cpu chip

 

Copyright © www.teach-ict.com