Microchip Technology MA180023 Data Sheet

Page of 536
 2011 Microchip Technology Inc.
 
DS39932D-page 311
PIC18F46J11 FAMILY
The following events will cause the MSSP Interrupt
Flag bit, SSPxIF, to be set (and MSSP interrupt, if
enabled):
• Start condition
• Stop condition
• Data transfer byte transmitted/received
• Acknowledge transmitted
• Repeated Start
FIGURE 19-18:
MSSPx BLOCK DIAGRAM (I
2
C™ MASTER MODE)
19.5.6.1
I
2
C Master Mode Operation
The master device generates all of the serial clock
pulses and the Start and Stop conditions.   A transfer is
ended with a Stop condition or with a Repeated Start
condition. Since the Repeated Start condition is also
the beginning of the next serial transfer, the I
2
C bus will
not be released.
In Master Transmitter mode, serial data is output
through SDAx while SCLx outputs the serial clock. The
first byte transmitted contains the slave address of the
receiving device (7 bits) and the Read/Write (R/W) bit.
In this case, the R/W bit will be logic ‘0’. Serial data is
transmitted 8 bits at a time. After each byte is transmit-
ted, an Acknowledge bit is received. S and P conditions
are output to indicate the beginning and the end of a
serial transfer.
In Master Receive mode, the first byte transmitted
contains the slave address of the transmitting device
(7 bits) and the R/W bit. In this case, the R/W bit will be
logic ‘1’. Thus, the first byte transmitted is a 7-bit slave
address, followed by a ‘1’ to indicate the receive bit.
Serial data is received via SDAx, while SCLx outputs
the serial clock. Serial data is received 8 bits at a time.
After each byte is received, an Acknowledge bit is
transmitted. S and P conditions indicate the beginning
and end of transmission.
The BRG, used for the SPI mode operation, is used to
set the SCLx clock frequency for either 100 kHz,
400 kHz  or  1 MHz  I
2
C operation. Se
 for more details.
Note:
The MSSP module, when configured in
I
2
C Master mode, does not allow queueing
of events. For instance, the user is not
allowed to initiate a Start condition and
immediately write the SSPxBUF register
to initiate transmission before the Start
condition is complete. In this case, the
SSPxBUF will not be written to and the
WCOL bit will be set, indicating that a write
to the SSPxBUF did not occur.
Read
Write
SSPxSR
Start bit, Stop bit,
SSPxBUF
Internal
Data Bus
Set/Reset S, P (SSPxSTAT), WCOL (SSPxCON1) 
Shift
Clock
MSb
LSb
SDAx
Acknowledge
Generate
Stop bit Detect
Write Collision Detect
Clock Arbitration
State Counter for
End of XMIT/RCV
SCLx
SCLx In
Bus Collision
SDAx In
Rec
e
ive Enable
Cloc
k C
n
tl
Clock Ar
bi
tr
at
e/
W
C
O
L
 Det
e
ct
(h
ol
d of
cl
o
ck sourc
e
)
SSPxADD<6:0>
Baud
Set SSPxIF, BCLxIF
Reset ACKSTAT, PEN (SSPxCON2)
Rate
Generator
SSPM<3:0>
Start bit Detect