What are the Registers in microcontroller?

Registers store the state of the CPU. If the contents of microcontroller memory and the contents of these registers are saved it is possible to suspend program operation for an indefinite period of time and restart exactly in the state when the program was suspended.

The number and names of registers varies drastically among microcontrollers. However there are certain registers which are common to most microcontrollers, although the names may vary. These include:
"# The stack pointer

The stack pointer contains the address of the next location on the stack.The address in the stack pointer is decremented when data is pushed on the stack and incremented when data is popped from the stack.

"# The index register
The index register is used to specify an address when certain addressing modes are used. It is also known as the pointer register. The Microchip devices use the name FSR (file select register).

"# The program counter
Perhaps the single most important CPU register is the program counter (PC). The PC holds the address of the next instruction in program memory space. It contains the address of the next instruction the CPU will process.
As each instruction is fetched and processed by the ALU, the CPU increments the PC and thereby steps through the program stored in the program memory space.

"# The accumulator
The accumulator is a register that can hold operands or results of operations as necessary. The Microchip devices use the name W (working) register.

Other registers may reflect results from the instruction just executed, control the options available on the device, and enable access to certain areas of memory.


Post a Comment

If you have any questions or droughts feel free to ask here.