English
Language : 

PIC17C7XX_13 Datasheet, PDF (131/306 Pages) Microchip Technology – High-Performance 8-bit CMOS EPROM Microcontrollers with 10-bit A/D
14.4 USART Synchronous Slave Mode
The Synchronous Slave mode differs from the Master
mode, in the fact that the shift clock is supplied exter-
nally at the TX/CK pin (instead of being supplied inter-
nally in the Master mode). This allows the device to
transfer or receive data in the SLEEP mode. The Slave
mode is entered by clearing the CSRC (TXSTA<7>) bit.
14.4.1 USART SYNCHRONOUS SLAVE
TRANSMIT
The operation of the SYNC Master and Slave modes
are identical except in the case of the SLEEP mode.
If two words are written to TXREG and then the SLEEP
instruction executes, the following will occur. The first
word will immediately transfer to the TSR and will trans-
mit as the shift clock is supplied. The second word will
remain in TXREG. TXIF will not be set. When the first
word has been shifted out of TSR, TXREG will transfer
the second word to the TSR and the TXIF flag will now
be set. If TXIE is enabled, the interrupt will wake the
chip from SLEEP and if the global interrupt is enabled,
then the program will branch to the interrupt vector
(0020h).
Steps to follow when setting up a Synchronous Slave
Transmission:
1. Enable the synchronous slave serial port by set-
ting the SYNC and SPEN bits and clearing the
CSRC bit.
2. Clear the CREN bit.
3. If interrupts are desired, then set the TXIE bit.
4. If 9-bit transmission is desired, then set the TX9
bit.
5. If 9-bit transmission is selected, the ninth bit
should be loaded in TX9D.
6. Start transmission by loading data to TXREG.
7. Enable the transmission by setting TXEN.
Writing the transmit data to the TXREG, then enabling
the transmit (setting TXEN), allows transmission to
start sooner than doing these two events in the reverse
order.
Note:
To terminate a transmission, either clear
the SPEN bit, or the TXEN bit. This will
reset the transmit logic, so that it will be in
the proper state when transmit is re-
enabled.
PIC17C7XX
14.4.2 USART SYNCHRONOUS SLAVE
RECEPTION
Operation of the Synchronous Master and Slave
modes are identical except in the case of the SLEEP
mode. Also, SREN is a “don't care” in Slave mode.
If receive is enabled (CREN) prior to the SLEEP instruc-
tion, then a word may be received during SLEEP. On
completely receiving the word, the RSR will transfer the
data to RCREG (setting RCIF) and if the RCIE bit is set,
the interrupt generated will wake the chip from SLEEP.
If the global interrupt is enabled, the program will
branch to the interrupt vector (0020h).
Steps to follow when setting up a Synchronous Slave
Reception:
1. Enable the synchronous master serial port by
setting the SYNC and SPEN bits and clearing
the CSRC bit.
2. If interrupts are desired, then set the RCIE bit.
3. If 9-bit reception is desired, then set the RX9 bit.
4. To enable reception, set the CREN bit.
5. The RCIF bit will be set when reception is com-
plete and an interrupt will be generated if the
RCIE bit was set.
6. Read RCSTA to get the ninth bit (if enabled) and
determine if any error occurred during reception.
7. Read the 8-bit received data by reading
RCREG.
8. If any error occurred, clear the error by clearing
the CREN bit.
Note:
To abort reception, either clear the SPEN
bit, or the CREN bit (when in Continuous
Receive mode). This will reset the receive
logic, so that it will be in the proper state
when receive is re-enabled.
 1998-2013 Microchip Technology Inc.
DS30289C-page 131