EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #378 background imageLoading...
Page #378 background image
378
Software UART
Software UART is seldom needed but it comes really useful in absence of hardware UART. In some
cases, we may not have the luxury of using hardware UART. Hardware UART block may also be absent.
We already know that USCI module can be used for implementing hardware UART but this block is not
present in chips like MSP430G2452. In such devices, we have to use software-generated UART.
Software UART uses ordinary digital I/Os and delays. Both additionally and optionally external
interrupts and timers can be used for better results. Owing to its hardware independency and
simplicity, it is very robust. However extra coding and therefore extra memory spaces are needed.
Code Example
SW_UART.h
#include <msp430.h>
#include "delay.h"
#define SW_UART_RXD_DIR P1DIR
#define SW_UART_TXD_DIR P1DIR
#define SW_UART_RXD_OUT P1OUT
#define SW_UART_TXD_OUT P1OUT
#define SW_UART_RXD_IN P1IN
#define SW_UART_RXD_IN_RES P1REN
#define SW_UART_RXD_PIN BIT1
#define SW_UART_TXD_PIN BIT2
#define SW_UART_RXD_DIR_IN() do{SW_UART_RXD_OUT |= SW_UART_RXD_PIN;
SW_UART_RXD_DIR &= ~SW_UART_RXD_PIN; SW_UART_RXD_IN_RES |=
SW_UART_RXD_PIN;}while(0)
#define SW_UART_TXD_DIR_OUT() do{SW_UART_TXD_DIR |= SW_UART_TXD_PIN;}while(0)
#define SW_UART_TXD_OUT_HIGH() do{SW_UART_TXD_OUT |= SW_UART_TXD_PIN;}while(0)
#define SW_UART_TXD_OUT_LOW() do{SW_UART_TXD_OUT &= ~SW_UART_TXD_PIN;}while(0)
#define SW_UART_RXD_INPUT() (SW_UART_RXD_IN & SW_UART_RXD_PIN)

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals