Three simple steps to operate the msp430 serial port interrupt
[Copy link]
Preliminary knowledge: I use msp430fr6989 (msp430 series are similar), there is a very key sentence in the datasheet:
30.3.15.1 UART Transmit Interrupt Operation
The UCTXIFG interrupt flag is set by the transmitter to indicate that UCAxTXBUF is ready to accept
another character. An interrupt request is generated if UCTXIE and GIE are also set. UCTXIFG is
automatically reset if a character is written to UCAxTXBUF
.
So the general idea of the serial port interrupt program is:
1. For example, define char a[100], assign UCTXIE to 1 in our software (GIE can be ignored), and enter the interrupt function
2. After entering the interrupt function, a[0] is sent to UCAxTXBUF, the interrupt function ends, and after UCAxTXBUF completes sending a[0], the UCTXIFG interrupt flag is triggered, and the interrupt function is entered again, and a[1] is sent. The interrupt function ends, and after UCAxTXBUF completes sending a[1], the UCTXIFG interrupt flag is triggered..........After sending a[99]
3. After sending a[99], turn off the serial port interrupt, over.
|