EasyManua.ls Logo

Microchip Technology dsPIC30F - UART Configuration

Microchip Technology dsPIC30F
738 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
Loading...
dsPIC30F Family Reference Manual
DS70066C-page 19-10 © 2004 Microchip Technology Inc.
19.4 UART Configuration
The UART uses standard non-return-to-zero (NRZ) format (one Start bit, eight or nine data bits,
and one or two Stop bits). Parity is supported by the hardware, and may be configured by the
user as even, odd or no parity. The most common data format is 8 bits, no parity and one Stop
bit (denoted as 8, N, 1), which is the default (POR) setting. The number of data bits and Stop bits,
and the parity, are specified in the PDSEL<1:0> (UxMODE<2:1>) and STSEL (UxMODE<0>)
bits. An on-chip dedicated 16-bit baud rate generator can be used to derive standard baud rate
frequencies from the oscillator. The UART transmits and receives the LSb first. The UART’s
transmitter and receiver are functionally independent, but use the same data format and baud
rate.
19.4.1 Enabling the UART
The UART module is enabled by setting the UARTEN (UxMODE<15>) bit and UTXEN
(UxSTA<10>) bit. Once enabled, the UxTX and UxRX pins are configured as an output and an
input, respectively, overriding the TRIS and PORT register bit settings for the corresponding I/O
port pins. The UxTX pin is at logic ‘1’ when no transmission is taking place.
19.4.2 Disabling the UART
The UART module is disabled by clearing the UARTEN (UxMODE<15>) bit. This is the default
state after any Reset. If the UART is disabled, all UART pins operate as port pins under the
control of their corresponding PORT and TRIS bits.
Disabling the UART module resets the buffers to empty states. Any data characters in the buffers
are lost, and the baud rate counter is reset.
All error and status flags associated with the UART module are reset when the module is
disabled. The URXDA, OERR, FERR, PERR, UTXEN, UTXBRK and UTXBF bits are cleared,
whereas RIDLE and TRMT are set. Other control bits, including ADDEN, URXISEL<1:0>,
UTXISEL, as well as the UxMODE and UxBRG registers, are not affected.
Clearing the UARTEN bit while the UART is active will abort all pending transmissions and
receptions and reset the module as defined above. Re-enabling the UART will restart the UART
in the same configuration.
19.4.3 Alternate UART I/O Pins
Some dsPIC30F devices have an alternate set of UART transmit and receive pins that can be
used for communications. The alternate UART pins are useful when the primary UART pins are
shared by other peripherals. The alternate I/O pins are enabled by setting the ALTIO bit
(UxMODE<10>). If ALTIO = 1, the UxATX and UxARX pins (alternate transmit and alternate
receive pins, respectively) are used by the UART module, instead of the UxTX and UxRX pins.
If ALTIO = 0, the UxTX and UxRX pins are used by the UART module.
Note: The UTXEN bit should not be set until the UARTEN bit has been set. Otherwise,
UART transmissions will not be enabled.

Table of Contents

Other manuals for Microchip Technology dsPIC30F