So this is meant to be paired with a UART program. This code is not all my own but I could not remember where I found it. I have edited the original quite a bit but the same structure is still there. If someone recognizes it please let me know so I can give credit.
Printf Code (CCS V5)
Project File Ver1.0
This code is currently for the MSP430G2553 on the Ti LaunchPad. The MSP430G2553 has a built in USCI that can be used for UART. Unlike lower end models of the value line you do not have to make a slow software UART. I looked online and did not see any UART libraries that where nice to work with without hacking them apart. I did not see any FIFO implementations at all either. They generally waited on the UART to finish its business before sending more data.
The advantage of the FIFO allows the MSP430 to push that data into the FIFO as fast as it can and let the hardware UART do the rest of the job. This frees up the CPU to do allot more stuff. The only bad thing is that if the FIFO gets full you start loosing data. The code has a global flag to let the main code know that the FIFOs are full.
The Receive (RX) portions of the code also have a global mailbox flag to notify the rest of the code that the UART received something. This would be useful if you need to send commands to a robot or device.
There are 4 different flavors of the code.
1. RX TX
2. RX TX with a FIFO
3. TX only
4. TX only with a FIFO
The code without the FIFOs waits on the UART during the transmission but uses far less memory then the FIFO code. You have to sacrifice speed or memory on this one. The TX only code strips out the RX portions if you just want to have the msp-430 print to a terminal. This is useful for debugging purposes.
If you are going to use this on the MSP-430 LaunchPad then you will need to cross the RX and TX lines. This pdf I found on the internet explains on page 3 (step 6) what I am talking about.
RX TX UART Code (CCS V5)
RX TX UART FIFO Code (CCS V5)
TX UART Code (CCS V5)
TX UART FIFO Code (CCS V5)
FIFO Code (CCS V5)