EUSART
EUSART
EUSART
25.0 ENHANCED UNIVERSAL These devices typically do not have internal clocks for
baud rate generation and require the external clock
SYNCHRONOUS
signal provided by a master synchronous device.
ASYNCHRONOUS RECEIVER
The EUSART module includes the following capabilities:
TRANSMITTER (EUSART)
• Full-duplex asynchronous transmit and receive
• Two-character input buffer
Note: The PIC16(L)F1946/47 devices have two • One-character output buffer
EUSARTs. Therefore, all information in • Programmable 8-bit or 9-bit character length
this section refers to both EUSART 1 and • Address detection in 9-bit mode
EUSART 2.
• Input buffer overrun error detection
The Enhanced Universal Synchronous Asynchronous • Received character framing error detection
Receiver Transmitter (EUSART) module is a serial I/O • Half-duplex synchronous master
communications peripheral. It contains all the clock
• Half-duplex synchronous slave
generators, shift registers and data buffers necessary
to perform an input or output serial data transfer • Programmable clock polarity in synchronous
independent of device program execution. The modes
EUSART, also known as a Serial Communications • Sleep operation
Interface (SCI), can be configured as a full-duplex The EUSART module implements the following
asynchronous system or half-duplex synchronous additional features, making it ideally suited for use in
system. Full-Duplex mode is useful for Local Interconnect Network (LIN) bus systems:
communications with peripheral systems, such as CRT
• Automatic detection and calibration of the baud rate
terminals and personal computers. Half-Duplex
Synchronous mode is intended for communications • Wake-up on Break reception
with peripheral devices, such as A/D or D/A integrated • 13-bit Break character transmit
circuits, serial EEPROMs or other microcontrollers. Block diagrams of the EUSART transmitter and
receiver are shown in Figure 25-1 and Figure 25-2.
TXEN
TRMT
Baud Rate Generator FOSC
÷n
TX9
BRG16 n
+1 Multiplier x4 x16 x64
TX9D
SYNC 1 X 0 0 0
SPxBRGH SPxBRGL BRGH X 1 1 0 0
BRG16 X 1 0 1 0
BRG16
+1 n
Multiplier x4 x16 x64
SYNC 1 X 0 0 0
SPxBRGH SPxBRGL BRGH X 1 1 0 0 FIFO
FERR RX9D RCxREG Register
BRG16 X 1 0 1 0
8
Data Bus
RCxIF Interrupt
RCxIE
Write to TXxREG
Word 1
BRG Output
(Shift Clock)
TXx/CKx pin
Start bit bit 0 bit 1 bit 7/8 Stop bit
Word 1
TXxIF bit
(Transmit Buffer 1 TCY
Reg. Empty Flag)
Write to TXxREG
Word 1 Word 2
BRG Output
(Shift Clock)
TXx/CKx pin Start bit Start bit
bit 0 bit 1 bit 7/8 Stop bit bit 0
TXxIF bit 1 TCY Word 1 Word 2
(Interrupt Reg. Flag)
1 TCY
TRMT bit Word 1 Word 2
(Transmit Shift Transmit Shift Reg
Reg. Empty Flag) Transmit Shift Reg
Read Rcv
Buffer Reg
RCxREG
RCxIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RXx/DTx input. The RCxREG (receive buffer) is read after the third
word, causing the OERR (overrun) bit to be set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 — — — 300 0.16 207 300 0.00 191 300 0.16 51
1200 1202 0.16 103 1202 0.16 51 1200 0.00 47 1202 0.16 12
2400 2404 0.16 51 2404 0.16 25 2400 0.00 23 — — —
9600 9615 0.16 12 — — — 9600 0.00 5 — — —
10417 10417 0.00 11 10417 0.00 5 — — — — — —
19.2k — — — — — — 19.20k 0.00 2 — — —
57.6k — — — — — — 57.60k 0.00 0 — — —
115.2k — — — — — — — — — — — —
BAUD FOSC = 32.000 MHz FOSC = 18.432 MHz FOSC = 16.000 MHz FOSC = 11.0592 MHz
RATE SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 — — — — — — — — — — — —
1200 — — — — — — — — — — — —
2400 — — — — — — — — — — — —
9600 9615 0.16 207 9600 0.00 119 9615 0.16 103 9600 0.00 71
10417 10417 0.00 191 10378 -0.37 110 10417 0.00 95 10473 0.53 65
19.2k 19.23k 0.16 103 19.20k 0.00 59 19.23k 0.16 51 19.20k 0.00 35
57.6k 57.14k -0.79 34 57.60k 0.00 19 58.82k 2.12 16 57.60k 0.00 11
115.2k 117.64k 2.12 16 115.2k 0.00 9 111.1k -3.55 8 115.2k 0.00 5
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 — — — — — — — — — 300 0.16 207
1200 — — — 1202 0.16 207 1200 0.00 191 1202 0.16 51
2400 2404 0.16 207 2404 0.16 103 2400 0.00 95 2404 0.16 25
9600 9615 0.16 51 9615 0.16 25 9600 0.00 23 — — —
10417 10417 0.00 47 10417 0.00 23 10473 0.53 21 10417 0.00 5
19.2k 19231 0.16 25 19.23k 0.16 12 19.2k 0.00 11 — — —
57.6k 55556 -3.55 8 — — — 57.60k 0.00 3 — — —
115.2k — — — — — — 115.2k 0.00 1 — — —
BAUD FOSC = 32.000 MHz FOSC = 18.432 MHz FOSC = 16.000 MHz FOSC = 11.0592 MHz
RATE SPxBRGH: SPxBRGH: SPxBRGH: SPxBRGH:
Actual % Actual % Actual % Actual %
SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 300.0 0.00 6666 300.0 0.00 3839 300.03 0.01 3332 300.0 0.00 2303
1200 1200.1 0.02 3332 1200 0.00 959 1200.5 0.04 832 1200 0.00 575
2400 2401 -0.04 832 2400 0.00 479 2398 -0.08 416 2400 0.00 287
9600 9615 0.16 207 9600 0.00 119 9615 0.16 103 9600 0.00 71
10417 10417 0.00 191 10378 -0.37 110 10417 0.00 95 10473 0.53 65
19.2k 19.23k 0.16 103 19.20k 0.00 59 19.23k 0.16 51 19.20k 0.00 35
57.6k 57.14k -0.79 34 57.60k 0.00 19 58.82k 2.12 16 57.60k 0.00 11
115.2k 117.6k 2.12 16 115.2k 0.00 9 111.11k -3.55 8 115.2k 0.00 5
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPxBRGH: SPxBRGH: SPxBRGH: SPxBRGH:
Actual % Actual % Actual % Actual %
SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 299.9 -0.02 1666 300.1 0.04 832 300.0 0.00 767 300.5 0.16 207
1200 1199 -0.08 416 1202 0.16 207 1200 0.00 191 1202 0.16 51
2400 2404 0.16 207 2404 0.16 103 2400 0.00 95 2404 0.16 25
9600 9615 0.16 51 9615 0.16 25 9600 0.00 23 — — —
10417 10417 0.00 47 10417 0.00 23 10473 0.53 21 10417 0.00 5
19.2k 19.23k 0.16 25 19.23k 0.16 12 19.20k 0.00 11 — — —
57.6k 55556 -3.55 8 — — — 57.60k 0.00 3 — — —
115.2k — — — — — — 115.2k 0.00 1 — — —
BAUD FOSC = 32.000 MHz FOSC = 18.432 MHz FOSC = 16.000 MHz FOSC = 11.0592 MHz
RATE SPxBRGH: SPxBRGH: SPxBRGH: SPxBRGH:
Actual % Actual % Actual % Actual %
SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 300 0.00 26666 300.0 0.00 15359 300.0 0.00 13332 300.0 0.00 9215
1200 1200 0.00 6666 1200 0.00 3839 1200.1 0.01 3332 1200 0.00 2303
2400 2400 0.01 3332 2400 0.00 1919 2399.5 -0.02 1666 2400 0.00 1151
9600 9604 0.04 832 9600 0.00 479 9592 -0.08 416 9600 0.00 287
10417 10417 0.00 767 10425 0.08 441 10417 0.00 383 10433 0.16 264
19.2k 19.18k -0.08 416 19.20k 0.00 239 19.23k 0.16 207 19.20k 0.00 143
57.6k 57.55k -0.08 138 57.60k 0.00 79 57.97k 0.64 68 57.60k 0.00 47
115.2k 115.9 0.64 68 115.2k 0.00 39 114.29k -0.79 34 115.2k 0.00 23
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPxBRGH: SPxBRGH: SPxBRGH: SPxBRGH:
Actual % Actual % Actual % Actual %
SPxBRGL SPxBRGL SPxBRGL SPxBRGL
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 300.0 0.00 6666 300.0 0.01 3332 300.0 0.00 3071 300.1 0.04 832
1200 1200 -0.02 1666 1200 0.04 832 1200 0.00 767 1202 0.16 207
2400 2401 0.04 832 2398 0.08 416 2400 0.00 383 2404 0.16 103
9600 9615 0.16 207 9615 0.16 103 9600 0.00 95 9615 0.16 25
10417 10417 0.00 191 10417 0.00 95 10473 0.53 87 10417 0.00 23
19.2k 19.23k 0.16 103 19.23k 0.16 51 19.20k 0.00 47 19.23k 0.16 12
57.6k 57.14k -0.79 34 58.82k 2.12 16 57.60k 0.00 15 — — —
115.2k 117.6k 2.12 16 111.1k -3.55 8 115.2k 0.00 7 — — —
BRG Clock
RCIDL
RCxIF bit
(Interrupt)
Read
RCxREG
Note 1: The ABD sequence requires the EUSART module to be configured in Asynchronous mode.
RXx/DTx Line
RCxIF
Cleared due to User Read of RCxREG
Note 1: The EUSART remains in Idle while the WUE bit is set.
Note 1: If the wake-up event requires long oscillator warm-up time, the automatic clearing of the WUE bit can occur while the stposc signal is
still active. This sequence should not depend on the presence of Q clocks.
2: The EUSART remains in Idle while the WUE bit is set.
Write to TXxREG
Dummy Write
BRG Output
(Shift Clock)
Write to
TXxREG Reg Write Word 1 Write Word 2
TXxIF bit
(Interrupt Flag)
TRMT bit
‘1’ ‘1’
TXEN bit
Note: Sync Master mode, SPxBRGL = 0, continuous transmission of two 8-bit words.
TXx/CKx pin
Write to
TXxREG reg
TXxIF bit
TRMT bit
TXEN bit
RXx/DTx
pin bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7
TXx/CKx pin
(SCKP = 0)
TXx/CKx pin
(SCKP = 1)
Write to
bit SREN
SREN bit
RCxIF bit
(Interrupt)
Read
RCxREG
Note: Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRGH = 0.