NEC 78K0R/KE3 User Manual page 516

16-bit single-chip microcontrollers
Table of Contents

Advertisement

The main processing of the slave operation is explained next.
Start serial interface IIC0 and wait until communication is enabled. When communication is enabled, execute
communication by using the communication mode flag and ready flag (processing of the stop condition and
start condition is performed by an interrupt. Here, check the status by using the flags).
The transmission operation is repeated until the master no longer returns ACK. If ACK is not returned from the
master, communication is completed.
For reception, the necessary amount of data is received. When communication is completed, ACK is not
returned as the next data. After that, the master generates a stop condition or restart condition. Exit from the
communication status occurs in this way.
ACKE = WTIM = 1, SPIE = 0
No
No
No
Clearing communication
Remark
Conform to the specifications of the product that is in communication, regarding the transmission and
reception formats.
516
CHAPTER 12 SERIAL INTERFACE IIC0
Figure 12-26. Slave Operation Flowchart (1)
START
Sets the port used alternatively as the pin to be used.
Setting port
First, set the port to input mode and the output latch to 0 (see 12.3 (7) Port mode register 6 (PM6)).
IICX0 ¬ 0XH
Selects a transfer clock.
IICCL0 ¬ XXH
SVA0 ¬ XXH
Sets a local address.
IICF0 ¬ 0XH
Sets a start condition.
Setting IICRSV
IICC0 ¬ 0XX011XXB
IICC0 ¬ 1XX011XXB
IICE = 1
Sets the port from input mode to output mode and enables the output of the I
Setting port
(see 12.3 (7) Port mode register 6 (PM6)).
Communication
mode flag = 1?
Yes
No
Communication
direction flag = 1?
Yes
Starts
Writing IIC0
transmission.
Communication
mode flag = 1?
Yes
Communication
direction flag = 1?
Yes
No
Ready flag =
1?
Yes
Clearing ready flag
Yes
ACKD0 = 1?
No
mode flag
WREL0 = 1
User's Manual U17854EJ9V0UD
Starts
WREL0 = 1
reception.
No
Communication
mode flag = 1?
Yes
No
Communication
direction flag = 0?
Yes
No
Ready flag =
1?
Yes
Reading IIC0
Clearing ready flag
2
C bus

Advertisement

Table of Contents
loading

Table of Contents