1 Overview
MSP430F149 has 6 groups of IO ports, each with 8 bits. The settings of IO ports include setting IO function, direction, and initial value of input and output registers. If no settings are made for IO ports, the default setting is the first function, input mode.
2 Commonly used registers
PxDIR 0 input, 1 output;
PxSEL 0 I/O port, 1 second function;
PxOUT, PxIN;
PxIES sets the interrupt trigger mode to 0 rising edge, 1 falling edge;
PxIE sets the interrupt trigger to enable 0 to disable, 1 to enable;
PxIFG interrupt flag register, needs to be cleared by software.
3 Usage
IO port interrupt:
P1 and P2 have a total of 16 IO ports that can trigger interrupts. The relevant register is PXIE (interrupt enable): 0 does not allow, 1 allows. PXIES (interrupt trigger rock selection) 0 rising edge, 1 falling edge. PXIFG (interrupt flag register), when the I0 port meets the interrupt, the corresponding position is 1, which can only be cleared by software. P1 and P2 share two interrupt entry points PORT1_VECTOR and PORT2_VECTOR respectively. Note that the IO port interrupt mode input is still the first function, PXSEL=0.
|