PIC16C745/765
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 11.1)
Enable the asynchronous serial port by clearing
bit SYNC and setting bit SPEN.
If interrupts are desired, then set enable bit
TXIE.
4.
5.
6.
7.
If 9-bit transmission is desired, then set transmit
bit TX9.
Enable the transmission by setting bit TXEN,
which will also set bit TXIF.
If 9-bit transmission is selected, the ninth bit
should be loaded in bit TX9D.
Load data to the TXREG register (starts trans-
mission).
2.
3.
FIGURE 11-2: ASYNCHRONOUS MASTER TRANSMISSION
Write to TXREG
BRG output
(shift clock)
RC6/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
FIGURE 11-3: ASYNCHRONOUS MASTER TRANSMISSION (BACK TO BACK)
Write to TXREG
BRG output
(shift clock)
RC6/TX/CK (pin)
TXIF bit
(interrupt reg. flag)
Word 1
Word 2
Start Bit
Bit 0
Bit 1
WORD 1
Bit 7/8
Stop Bit
Start Bit
WORD 2
Bit 0
TRMT bit
(Transmit shift
reg. empty flag)
WORD 1
Transmit Shift Reg.
WORD 2
Transmit Shift Reg.
Note:
This timing diagram shows two consecutive transmissions.
TABLE 11-6:
Address
0Ch
18h
19h
8Ch
98h
99h
Name
PIR1
RCSTA
PIE1
TXSTA
REGISTERS ASSOCIATED WITH ASYNCHRONOUS TRANSMISSION
B
it 7
PSPIF
(1)
SPEN
PSPIE
(1)
CSRC
Bit 6
ADIF
RX9
ADIE
TX9
Bit 5
RCIF
SREN
RCIE
TXEN
Bit 4
TXIF
CREN
TXIE
SYNC
Bit 3
Bit 2
Bit 1
TMR2IF
OERR
TMR2IE
TRMT
Bit 0
Value on:
POR,
BOR
Value on
all other
Resets
0000 0000
0000 -00x
0000 0000
0000 0000
0000 -010
0000 0000
USBIF CCP1IF
鈥?/div>
FERR
TMR1IF
0000 0000
RX9D
0000 -00x
0000 0000
TXREG USART Transmit Register
USBIE CCP1IE
鈥?/div>
BRGH
TX9D
TMR1IE
0000 0000
0000 -010
0000 0000
SPBRG Baud Rate Generator Register
Legend:
x
= unknown,
-
= unimplemented locations read as '0'. Shaded cells are not used for asynchronous transmission.
Note 1:
Bits PSPIE and PSPIF are reserved on the PIC16C745; always maintain these bits clear.
DS41124A-page 80
Advanced Information
漏
1999 Microchip Technology Inc.
prev
next