20 I
2
C
S1C17704 TECHNICAL MANUAL
EPSON
20-7
The
I
2
C module provides two status bits for data transmit control, TBUSY flag (D8/I2C_CTL register) and
RTACK bit (D8/I2C_DAT register).
∗
TBUSY
: Transmit Busy Flag in the I
2
C Control (I2C_CTL) Register (D8/0x4342)
∗
RTACK
: Receive/Transmit ACK Bit in the I
2
C Data (I2C_DAT) Register (D8/0x4344)
The TBUSY flag indicates the data transmit status; it goes 1 when data transmission (including slave address
transmission) starts and returns to 0 upon completion of data transmission. Also TBUSY returns to 0 in wait state.
Read this flag to check whether the I
2
C module is busy or idle.
The RTACK bit indicates whether the slave returned ACK or not in a previous data transmission; it goes 0 when
an ACK bit is received or goes 1 if an ACK bit is not received.
Data receive control
The following explains how to receive data. Even in data reception, a START condition must be generated and
a slave address with the transfer direction bit set to 1 must be sent before starting data reception.
To receive byte data, set the RXE bit (D10/I2C_DAT register) to 1 to execute receiving one byte data. RXE can
be set to 1 at the same time when TXE (D9/I2C_DAT register) is set to 1 for sending a slave address. If TXE
and RXE are both set to 1, TXE is effective.
∗
RXE
: Receive Execution Bit in the I
2
C Data (I2C_DAT) Register (D10/0x4344)
When the RXE bit is set to 1 and the I
2
C module is ready to receive, the I
2
C module sets the SDA line into
high-impedance and starts outputting the clock from the SCL pin. The data bits are fetched in the shift register
one by one at the rising edge of the clock. The MSB is received first.
RXE is reset to 0 during fetching D6.
When eight data bits are received in the shift register, the received data is loaded into RTDT[7:0].
The
I
2
C module provides two status bits for data receive control, RBRDY (D11/I2C_DAT register) and RBUSY
(D9/I2C_CTL register).
∗
RBRDY
: Receive Buffer Ready Bit in the I
2
C Data (I2C_DAT) Register (D11/0x4344)
∗
RBUSY
: Receive Busy Flag in the I
2
C Control (I2C_CTL) Register (D9/0x4342)
The RBRDY flag indicates the received data status; it goes 1 when the received data in the shift register is
loaded into RTDT[7:0] and returns to 0 when the received data is read from RTDT[7:0]. An interrupt can be
generated when this flag goes 1. Use this interrupt or read the RBRDY flag to check that RTDT[7:0] contains
valid data when reading received data. If the next data has been received before the previous received data in
RTDT[7:0] is read, the previous received data is overwritten with the new data.
The RBUSY flag indicates the data receive operation status; it goes 1 when data reception starts and returns to
0 upon completion of data reception. Also RBUSY returns to 0 in wait state. Read this flag to check whether
the I
2
C module is busy or idle.
The
I
2
C module outputs nine clocks for one data transmission. In the ninth clock cycle, the I
2
C module sends an
ACK or NACK bit from the SDA pin to the slave. The bit status to be sent can be set to RTACK (D8/I2C_DAT
register). Set RTACK to 0 to send ACK or set to 1 to send NACK.
Terminating data transmission/reception
(1) Generating a STOP condition
To terminate data transfer after all data have been sent/received, the I
2
C master (this module) must generate a
STOP condition. The STOP condition is a state in which the SDA line is pulled up from low to high with the
SCL line held at high.
SDA (output)
SCL (output)
STOP condition
Figure 20.5.4 STOP Condition
Set the STP bit (D1/I2C_CTL register) to 1 to generate a STOP condition.
∗
STP
: Stop Control Bit in the I
2
C Control (I2C_CTL) Register (D1/0x4342)
Содержание S1C17704
Страница 1: ...TECHNICAL MANUAL S1C17704 CMOS 16 BIT SINGLE CHIP MICROCOMPUTER ...
Страница 22: ...1 OVERVIEW 1 10 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 42: ...3 MEMORY MAP BUS CONTROL 3 12 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 82: ...6 INTERRUPT CONTROLLER ITC 6 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 108: ...8 CLOCK GENERATOR CLG 8 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 112: ...9 PRESCALER PSC 9 4 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 138: ...10 I O PORTS P 10 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 156: ...11 16 BIT TIMERS T16 11 18 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 208: ...14 8 BIT OSC1 TIMER T8OSC1 14 16 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 234: ...16 STOPWATCH TIMER SWT 16 14 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 242: ...17 WATCHDOG TIMER WDT 17 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 264: ...18 UART 18 22 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 300: ...20 I2C 20 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 320: ...21 REMOTE CONTROLLER REMC 21 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 360: ...24 ON CHIP DEBUGGER DBG 24 6 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 362: ...25 BASIC EXTERNAL WIRING DIAGRAM 25 2 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...