The MSP430 microcontroller has sixteen 16-bits registers:
- 4 registers (R0, R1, R2 and R3) have special functions (detailled later)
- 12 general-purpose registers (R4 to R15)
R0 : Program Counter (PC) register
This register stores the address of the next instruction to execute
R1: stack pointer (SP) register
This register stores the memory address of the last data element added to the stack. The stack can store data for later use (with PUSH or POP) When calling a subroutine, the program counter is stored in the stack to retrieve the address of the instruction to execute when the function is exited.
R2: Status Register (SR)
This register stores many control bits, changed by instructions
Bit | Name | Description/Usage |
---|---|---|
9 to 15 | - | Reserved / Not used |
8 | V | buffer overflow. V=1 if the latest operation overflows the output range (ie #0FFFF + #0001) |
7 | SCG1 | System clock generator 1. Set it to 1 if DCO generator is turned off (if not used for MCLK or SMCLK) |
6 | SCG0 | System clock generator 0. This bit may be used to enable or disable functions in the clock system depending on the device family; for example, FLL enable or disable. |
5 | OSCOFF | Oscillator off. When this bit is set, it turns off the LFXT1 crystal oscillator when LFXT1CLK is not used for MCLK or SMCLK. |
4 | CPUOFF | CPU off. When this bit is set, it turns off the CPU core |
3 | GIE | General interrupt enable. 1 to enable maskable interrupts; 0 to disable all maskable interrupts. |
2 | N | Negative flag : 1 if the result of the latest operation is negative; 0 if the result was positive. |
1 | Z | Zero flag: 1 if the result of the latest operation was 0. 1 otherwise. |
0 | C | Carry flag. This bit is set when the result of an operation produced a carry and cleared when no carry occurred. |
R3 register
to document...
R4 to R15
Those registers can be used to store values, addresses pointers, ...
Comments !