
ML674001 Seies/ML675001 Series User’s Manual
Chapter 20
I2C
20-14
20.3.3
Transmit operation (transfer of 2 or more bytes from master to slave, in 7-bit address mode)
Repeat step
from section 20.3.1
Repeat step
from section 20.3.1
The I2CCON register is set to XXX0X110.
The following series of operations is automatically performed
when the STCM bit (bit 2 of the I2CCON register) is set to "1": Transmission of the start sequence,
transmission of the slave address and the transfer direction specified to the I2CSAD register, confirmation of
an acknowledge from the slave device for the address transmitted , transmission of the transmit data specified
to the I2CDR register, and confirmation of an acknowledge from the slave device for the data transmitted.
Here, because the I2COC bit (bit 1 of the I2CCON register) is set to "1," the stop sequence will not be
transmitted (the bus remains busy) and the command wait state is activated.
At this point, the I2CIR bit is
set to "1," indicating that the transmission of 1-byte of data has been finished.
If acknowledges for the
address and data transmitted have not been returned normally, both the I2CAAK and I2CDAK bits are set to
"1" upon completion of transmission.
At this stage, the application program must monitor I2CAAK and I2CDAK bits for proper error handling and
recovery from I2C bus errors. Also, the application program should reset the I2CIR bit as necessary.
Multiple bytes are transmitted by repeating from step
to
the required number of times.
To transmit the last byte after multiple bytes have been transmitted, step
at the time of 1-byte transmit
operation is performed first.
Next, the stop sequence is transmitted (the bus is released) after the last byte is
transmitted, and transmission is then finished.
I2CSAD
I2CDR
I2CDR = xxxxxxxxb
I2CCON = xxx0x110b
I2CDR = xxxxxxxxb
I2CCON = xxx0x100b
Flag
Register
settings
Waits for
I2CCON setting
Transmission
complete
1-byte transmission
finishes
I2CIR = 1
(I2CAAK = 0)
I2CIR = 1
1-byte transmission
finishes
Waits for
I2CCON setting
I2CDR
S B
7
B
6
B
5
B
4
B
3
B
2
B
1
A B
7
B
6
B
5
B
4
B
3
B
2
B
1
B
0
A B
7
B
6
B
5
B
4
B
3
B
2
B
1
B
0
A B
7
B
6
B
5
B
4
B
3
B
2
B
1
B
0
A P
I2CSAD = xxxxxxx0b
I2CDR = xxxxxxxxb
I2CCON = xxx0x110b
Output
S
P
S
r
A
Input
Start
sequence
Stop
sequence
Restart
sequence
Acknowledge
received
Negative
acknowledge
received
Acknowledge
transmitted
Negative
acknowledge
transmitted