English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (437/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
19.3 Transmitting in 8-bit Data Mode
1. Set up the UART:
a) Write appropriate values for data, parity and
Stop bits.
b) Write appropriate baud rate value to the
UxBRG register.
c) Set up transmit and receive interrupt enable
and priority bits.
2. Enable the UART.
3. Set the UTXEN bit (causes a transmit interrupt).
4. Write data byte to UxTXREG word. The value
will be immediately transferred to the Transmit
Shift Register (TSR), and the serial bit stream
will start shifting out with next rising edge of the
baud clock.
5. Alternately, the data byte may be transferred
while UTXEN = 0, and then the user may set
UTXEN. This will cause the serial bit stream to
begin immediately because the baud clock will
start from a cleared state.
6. A transmit interrupt will be generated as per
interrupt control bit, UTXISEL<1:0>.
EXAMPLE 19-2: EXAMPLE 8-BIT DATA MODE
/* The following code example demonstrates configuring
UART1 for 8-bit Data Transmit mode.
*/
U1BRG = #BaudRate;
U1MODESET= 0x8000;
U1STASET= 0x1400;
// Set Uart baud rate.
// Enable Uart for 8-bit Data, no Parity, and 1 Stop bit
// Enable Transmitter and Receiver
19.4 Transmitting in 9-bit Data Mode
1. Set up the UART (as described in Section 19.3).
2. Enable the UART.
3. Set the UTXEN bit (causes a transmit interrupt).
4. Write UxTXREG as a 16-bit value only.
5. A write to UxTXREG triggers the transfer of the
9-bit data to the TSR. Serial bit stream will start
shifting out with the first rising edge of the baud
clock.
6. A transmit interrupt will be generated as per the
setting of control bit, UTXISEL<1:0>.
EXAMPLE 19-3: EXAMPLE 9-BIT DATA MODE
/* The following code example demonstrates configuring
UART1 for 9-bit Data Transmit mode.
*/
U1BRG = #BaudRate;
U1MODESET= 0x8006;
U1STASET= 0x1211420;
Receiver
// Set Uart baud rate.
// Enable Uart for 8-bit Data, no Parity, and 1 Stop bit
// Enable Address Detect, Set Address = 0x21, Enable Transmitter and
© 2008 Microchip Technology Inc.
Preliminary
DS61143E-page 435