English
Language : 

PIC18F6585 Datasheet, PDF (245/496 Pages) Microchip Technology – 64/68/80-Pin High-Performance, 64-Kbyte Enhanced Flash Microcontrollers with ECAN Module
PIC18F6585/8585/6680/8680
18.2.5 BREAK CHARACTER SEQUENCE
The enhanced USART module has the capability of
sending the special break character sequences that
are required by the LIN bus standard. The break char-
acter transmit consists of a Start bit, followed by twelve
‘0’ bits and a Stop bit. The frame break character is sent
whenever the SENDB and TXEN bits (TXSTA<3> and
TXSTA<5>) are set while the Transmit Shift register is
loaded with data. Note that the value of data written to
TXREG will be ignored and all ‘0’s will be transmitted.
The SENDB bit is automatically reset by hardware after
the corresponding Stop bit is sent. This allows the user
to preload the transmit FIFO with the next transmit byte
following the break character (typically, the sync
character in the LIN specification).
Note that the data value written to the TXREG for the
break character is ignored. The write simply serves the
purpose of initiating the proper sequence.
The TRMT bit indicates when the transmit operation is
active or Idle, just as it does during normal transmis-
sion. See Figure 18-9 for the timing of the break
character sequence.
18.2.5.1 Break and Sync Transmit Sequence
The following sequence will send a message frame
header made up of a break, followed by an auto-baud
sync byte. This sequence is typical of a LIN bus master.
1. Configure the USART for the desired mode.
2. Set the TXEN and SENDB bits to set up the
break character.
3. Load the TXREG with a dummy character to
initiate transmission (the value is ignored).
4. Write ‘55h’ to TXREG to load the sync character
into the transmit FIFO buffer.
5. After the break has been sent, the SENDB bit is
reset by hardware. The sync character now
transmits in the preconfigured mode.
When the TXREG becomes empty, as indicated by the
TXIF, the next data byte can be written to TXREG.
18.2.6 RECEIVING A BREAK CHARACTER
The enhanced USART module can receive a break
character in two ways.
The first method forces the configuration of the baud
rate at a frequency of 9/13 the typical speed. This
allows for the Stop bit transition to be at the correct
sampling location (13 bits for break versus Start bit and
8 data bits for typical data).
The second method uses the auto-wake-up feature
described in Section 18.2.4 “Auto-Wake-up on Sync
Break Character”. By enabling this feature, the
USART will sample the next two transitions on RX/DT,
cause an RCIF interrupt, and receive the next data byte
followed by another interrupt.
Note that following a break character, the user will typ-
ically want to enable the auto-baud rate detect feature.
For both methods, the user can set the ABD bit once
the TXIF interrupt is observed.
FIGURE 18-9:
Write to TXREG
BRG Output
(Shift Clock)
TX (pin)
TXIF bit
(Transmit Buffer
Reg. Empty Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
SENDB
(Transmit Shift
Reg. Empty Flag)
SEND BREAK CHARACTER SEQUENCE
Dummy Write
Start Bit
Bit 0
Bit 1
Break
SENDB Sampled Here
Bit 11
Stop Bit
Auto-Cleared
 2004 Microchip Technology Inc.
DS30491C-page 243