Datasheet

2003 Microchip Technology Inc. Preliminary DS40300C-page 75
PIC16F62X
FIGURE 12-5: USART TRANSMIT BLOCK DIAGRAM
Steps to follow when setting up an Asynchronous
Transmission:
1. Initialize the SPBRG register for the appropriate
baud rate. If a high speed baud rate is desired,
set bit BRGH. (Section 12.1)
2. Enable the asynchronous serial port by clearing
bit SYNC and setting bit SPEN.
3. If interrupts are desired, then set enable bit
TXIE.
4. If 9-bit transmission is desired, then set transmit
bit TX9.
5. Enable the transmission by setting bit TXEN,
which will also set bit TXIF.
6. If 9-bit transmission is selected, the ninth bit
should be loaded in bit TX9D.
7. Load data to the TXREG register (starts
transmission).
FIGURE 12-6: ASYNCHRONOUS TRANSMISSION
TXIF
TXIE
Interrupt
TXEN
Baud Rate CLK
SPBRG
Baud Rate Generator
TX9D
MSb
LSb
Data Bus
TXREG register
TSR register
(8)
0
TX9
TRMT
SPEN
RB2/TX/CK pin
Pin Buffer
and Control
8
2 2 2
WORD 1
STOP Bit
WORD 1
Transmit Shift Reg
START Bit Bit 0 Bit 1 Bit 7/8
Write to TXREG
Word 1
BRG output
(shift clock)
RB2/TX/CK (pin)
TXIF bit
(Transmit buffer
reg. empty flag)
TRMT bit
(Transmit shift
reg. empty flag)