Upload
maurice-souter
View
231
Download
2
Embed Size (px)
Citation preview
MSP430 USART
Afonso Ferreira Miguel
Características - Assíncrono
Operação USART
In UART mode, the USART transmits and receives characters at a bit rate asynchronous to another device. Timing for each character is based on the selected baud rate of the USART. The transmit and receive functions use the same baud rate frequency.
Inicialização
Set SWRST (BIS.B #SWRST,&UxCTL) Initialize all USART registers with SWRST = 1
(including UxCTL) Enable USART module via the MEx SFRs
(URXEx and/or UTXEx) Clear SWRST via software (BIC.B
#SWRST,&UxCTL) Enable interrupts (optional) via the IEx SFRs
(URXIEx and/or UTXIEx)
Failure to follow this process may result in unpredictable USART behavior.
Detecção de erros
The USART module automatically detects framing errors, parity errors, overrun errors, and break conditions when receiving characters. The bits FE, PE, OE, and BRK are set when their respective condition is detected. When any of these error flags are set, RXERR is also set. The error conditions are described in Table:
Detecção de erros
UxCTL
UxTCTL
UxRCTL
UxBR0, UxBR1 e UxMCTL
Ver arquivo Excel de configuração de Baud Rate
Byte de recepção
Byte de transmissão
Habilitação da recepção e transmissão da USART 0
Controle de dados enviados e recebidos
USART - Exemplo
Configuração
USART - Exemplo
Recebendo e Transmitindo