![](http://datasheet.mmic.net.cn/Microchip-Technology/PIC16C770-I-SO_datasheet_99438/PIC16C770-I-SO_82.png)
PIC16C717/770/771
DS41120B-page 80
Advance Information
2002 Microchip Technology Inc.
9.2.2.4
SLAVE TRANSMISSION
When the R/W bit of the incoming address byte is set
and an address match occurs, the R/W bit of the SSP-
STAT register is set. The received address is loaded
into the SSPBUF register on the falling edge of the
eighth SCL pulse. The ACK pulse will be sent on the
ninth bit, and the SCL pin is held low. The slave module
automatically stretches the clock by holding the SCL
line low so that the master will be unable to assert
another clock pulse until the slave is finished preparing
the transmit data. The transmit data must be loaded
into the SSPBUF register, which also loads the SSPSR
register. The CKP bit (SSPCON<4>) must then be set
to release the SCL pin from the forced low condition.
The eight data bits are shifted out on the falling edges
of the SCL input. This ensures that the SDA signal is
The ACK or NACK signal from the master-receiver is
latched on the rising edge of the ninth SCL input pulse.
The master-receiver terminates slave transmission by
sending a NACK. If the SDA line is high (NACK), then
the data transfer is complete. When the NACK is
latched by the slave, the slave logic is RESET which
also resets the R/W bit to ’0’. The slave module then
monitors for another occurrence of the START bit. The
slave firmware knows not to load another byte into the
SSPBUF register by sensing that the buffer is empty
(BF = 0) and the R/W bit has gone low. If the SDA line
is low (ACK), the R/W bit remains high indicating that
the next transmit data must be loaded into the SSPBUF
register.
An MSSP interrupt (SSPIF flag) is generated for each
data transfer byte on the falling edge of the ninth clock
pulse. The SSPIF flag bit must be cleared in software.
The SSPSTAT register is used to determine the status
of the byte transfer.
For more information about the I2C Slave mode, refer
to Application Note AN734, “Using the PICmicro SSP
for Slave I2C Communication”.
FIGURE 9-10:
I2C SLAVE MODE WAVEFORMS FOR TRANSMISSION (7-BIT ADDRESS)
SDA
SCL
SSPIF
BF (SSPSTAT<0>)
CKP (SSPCON<4>)
A7
A6
A5
A4
A3
A2
A1
ACK
D7
D6
D5
D4
D3
D2
D1
D0
NACK
Transmitting Data
R/W = 1
Receiving Address
1
2
3
4
567
89
1
2
3
4
5
6
7
8
9
P
cleared in software
SSPBUF is written in software
From SSP interrupt
service routine
Set bit after writing to SSPBUF
S
Data in
sampled
SCL held low
until SSPBUF
is written
(the SSPBUF must be written-to
before the CKP bit can be set)
R/W
← 0
Master terminates transmission
by responding with NACK