|mspgcc: A port of the GNU tools to the Texas Instruments MSP430 microcontrollers|
|<<< Previous||MSP430 specific extensions to the GNU toolchain||Next >>>|
The MSP430's memory mapped peripheral registers are termed special function registers (SFRs). The SFRs valid for the device you are using are declared when you include "io.h" in your source code, and specify the MCU architecture in the GCC command line.
You can consider any SFR as a normal variable, which is simply mapped to the specific memory location. You do not have to care about exactly which one.
SFRs are read from and written to using normal C assignments, so:
SFR = value;
variable = SFR;
All SFRs are declared as "volatile". This implies a-la Harvard architecture GCC behaviour for read-modify-write: mov SFR's value to a register, modify the register, write back to the SFR. However, the GCC port for the MSP430 takes into account the possibility that this can often be reduced to something like:
and.b #1, &0x0120