English
Language : 

PIC16F818_13 Datasheet, PDF (78/178 Pages) Microchip Technology – 18/20-Pin Enhanced Flash Microcontrollers with nanoWatt Technology
PIC16F818/819
An SSP interrupt is generated for each data transfer
byte. Flag bit SSPIF must be cleared in software and
the SSPSTAT register is used to determine the status
of the byte. Flag bit SSPIF is set on the falling edge of
the ninth clock pulse.
As a slave-transmitter, the ACK pulse from the master-
receiver is latched on the rising edge of the ninth SCL
input pulse. If the SDA line was high (not ACK), then
the data transfer is complete. When the ACK is latched
by the slave device, the slave logic is reset (resets
SSPSTAT register) and the slave device then monitors
for another occurrence of the Start bit. If the SDA line
was low (ACK), the transmit data must be loaded into
the SSPBUF register which also loads the SSPSR
register. Then pin RB4/SCK/SCL should be enabled by
setting bit, CKP.
TABLE 10-2: DATA TRANSFER RECEIVED BYTE ACTIONS
Status Bits as Data
Transfer is Received
BF
SSPOV
SSPSR  SSPBUF
Generate ACK Pulse
Set bit SSPIF
(SSP interrupt occurs if enabled)
0
1
1
0
Note 1:
0
Yes
Yes
Yes
0
No
No
Yes
1
No
No
Yes
1
No
No
Yes
Shaded cells show the conditions where the user software did not properly clear the overflow condition.
FIGURE 10-6:
I2C™ WAVEFORMS FOR RECEPTION (7-BIT ADDRESS)
SDA
Receiving Address R/W = 0 ACK
Receiving Data
ACK
Receiving Data
ACK
A7 A6 A5 A4 A3 A2 A1
D7 D6 D5 D4 D3 D2 D1 D0
D7 D6 D5 D4 D3 D2 D1 D0
SCL S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
P
SSPIF (PIR1<3>)
BF (SSPSTAT<0>)
Cleared in software
SSPBUF register is read
Bus master
terminates
transfer
SSPOV (SSPCON<6>)
Bit SSPOV is set because the SSPBUF register is still full
ACK is not sent
FIGURE 10-7:
I2C™ WAVEFORMS FOR TRANSMISSION (7-BIT ADDRESS)
SDA
Receiving Address
R/W = 1
A7 A6 A5 A4 A3 A2 A1
ACK
Transmitting Data ACK
D7 D6 D5 D4 D3 D2 D1 D0
SCL
S
1 23456789
1234 56789
P
Data is
SCL held low
Sampled
while CPU
responds to SSPIF
SSPIF (PIR1<3>)
Cleared in software
BF (SSPSTAT<0>)
CKP (SSPCON<4>)
From SSP Interrupt
SSPBUF is written in software Service Routine
Set bit after writing to SSPBUF
(the SSPBUF must be written to
before the CKP bit can be set)
DS39598F-page 78
 2001-2013 Microchip Technology Inc.