Microchip Technology DM163025-1 Data Sheet

Page of 536
 2012 Microchip Technology Inc.
DS30684A-page 291
PIC18(L)F2X/45K50
17.5.1.5
Synchronous Master Transmission 
Setup:
1.
Initialize the SPBRGHx, SPBRGx register pair
and the BRGH and BRG16 bits to achieve the
desired baud rate (see 
).
2.
Set the RX/DT and TX/CK TRIS controls to ‘1’.
3.
Enable the synchronous master serial port by
setting bits SYNC, SPEN and CSRC. Set the
TRIS bits corresponding to the RX/DT and TX/
CK I/O pins.
4.
Disable Receive mode by clearing bits SREN
and CREN.
5.
Enable Transmit mode by setting the TXEN bit.
6.
If 9-bit transmission is desired, set the TX9 bit.
7.
If interrupts are desired, set the TXIE, GIE/GIEH
and PEIE/GIEL interrupt enable bits.
8.
If 9-bit transmission is selected, the ninth bit
should be loaded in the TX9D bit.
9.
Start transmission by loading data to the
TXREGx register.
FIGURE 17-10:
SYNCHRONOUS TRANSMISSION       
FIGURE 17-11:
SYNCHRONOUS TRANSMISSION (THROUGH TXEN)       
 bit 0
 bit 1
 bit 7
Word 1
 bit 2
 bit 0
 bit 1
 bit 7
RX/DT
Write to
TXREGx Reg
TXIF bit
(Interrupt Flag)
TXEN bit
‘1’
‘1’
 Word 2
TRMT bit
Write Word 1
Write Word 2
Note:
Sync Master mode, SPBRGx = 0, continuous transmission of two 8-bit words.
pin
TX/CK pin
TX/CK pin
(SCKP = 0)
(SCKP = 1)
RX/DT pin
TX/CK pin
Write to
TXREGx reg
TXIF bit
TRMT bit
bit 0
bit 1
bit 2
bit 6
bit 7
TXEN bit