English
Language : 

PIC16F627A_05 Datasheet, PDF (80/180 Pages) Microchip Technology – Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology
PIC16F627A/628A/648A
FIGURE 12-1:
USART TRANSMIT BLOCK DIAGRAM
TXIE
TXIF
Interrupt
MSb
(8)
Data Bus
TXREG register
8
LSb
²²²
0
TSR register
Pin Buffer
and Control
RB2/TX/CK pin
TXEN Baud Rate CLK
SPBRG
TRMT
SPEN
Baud Rate Generator
TX9
TX9D
Follow these steps when setting up an Asynchronous
Transmission:
1. TRISB<1> and TRISB<2> should both be set to
‘1’ to configure the RB1/RX/DT and RB2/TX/CK
pins as inputs. Output drive, when required, is
controlled by the peripheral circuitry.
2. Initialize the SPBRG register for the appropriate
baud rate. If a high-speed baud rate is desired,
set bit BRGH. (Section 12.1 “USART Baud
Rate Generator (BRG)”).
3. Enable the asynchronous serial port by clearing
bit SYNC and setting bit SPEN.
4. If interrupts are desired, then set enable bit
TXIE.
5. If 9-bit transmission is desired, then set transmit
bit TX9.
6. Enable the transmission by setting bit TXEN,
which will also set bit TXIF.
7. If 9-bit transmission is selected, the ninth bit
should be loaded in bit TX9D.
8. Load data to the TXREG register (starts
transmission).
FIGURE 12-2:
ASYNCHRONOUS TRANSMISSION
Write to TXREG
BRG output
(shift clock)
RB2/TX/CK (pin)
TXIF bit
(Transmit buffer
reg. empty flag)
Word 1
Start bit
bit 0
bit 1
Word 1
bit 7/8 Stop bit
TRMT bit
(Transmit shift
reg. empty flag)
Word 1
Transmit Shift Reg.
DS40044D-page 78
© 2005 Microchip Technology Inc.