20 I
2
C
S1C17704 TECHNICAL MANUAL
EPSON
20-5
20.5 Data Transmit/Receive Control
Before starting data transfer, set up the conditions by the procedure below.
(1) Set up the 16-bit timer Ch.2 to output the I
2
C clock. See Chapter 11.
(2) Select optional functions. See Section 20.4.
(3) Set up the interrupt conditions if the I
2
C interrupt is used. See Section 20.6.
Note
: Make sure that the I
2
C module is disabled (I2CEN/I2C_EN register = 0) before setting the
conditions above.
∗
I2CEN
: I
2
C Enable Bit in the I
2
C Enable (I2C_EN) Register (D0/0x4340)
Enabling data transmission/reception
First, set the I2CEN bit (D0/I2C_EN register) to 1 to enable I
2
C operation. This makes the I
2
C in ready-to-
transmit/receive status and enables clock output.
Note
: Do not set the I2CEN bit to 0 while the I
2
C module is transmitting/receiving data.
Starting data transmission/reception
To start data transmission, the I
2
C master (this module) must generate a START condition, and then send a
slave address to establish the communication.
(1) Register setting procedure
To generate a START condition, set the following registers in the order shown below:
1. Set the slave address to RTDT[7:0] (D[7:0]/I2C_DAT register). (First transmit data when 10-bit address is
used; see Figure 20.5.2.)
2. Set TXE (D9/I2C_DAT register) to 1.
3. Set STRT (D0/I2C_CTL register) to 1.
∗
RTDT[7:0]
: Receive/Transmit Data Bits in the I
2
C Data (I2C_DAT) Register (D[7:0]/0x4344)
∗
TXE
: Transmit Execution Bit in the I
2
C Data (I2C_DAT) Register (D9/0x4344)
∗
STRT
: Start Control Bit in the I
2
C Control (I2C_CTL) Register (D0/0x4342)
This procedure generates the communication waveforms as shown in Items (2) and (3) below. Be sure to follow
the register setting procedure.
(2) Generating a START condition
The START condition is a state in which the SDA line is pulled down to low with the SCL line held at high.
SDA (output)
SCL (output)
START condition
Figure 20.5.1 START Condition
Set the STRT bit (D0/I2C_CTL register) to 1 to generate a START condition.
∗
STRT
: Start Control Bit in the I
2
C Control (I2C_CTL) Register (D0/0x4342)
After a START condition has been generated, STRT is automatically reset to 0.
(3) Sending a slave address
After a START condition has been generated, the I
2
C master (this module) sends the address of the slave to
communicate and a bit to specify data transfer direction. The I
2
C module supports two slave address sizes: 7-bit
slave address and 10-bit slave address. The I
2
C module sends the slave address bits with the transfer direction
bit using the 8-bit transmit/receive data register. So one 7-bit slave address can be sent at a time. A 10-bit
address should be sent in two parts with software control. Figure 20.5.2 shows the address data format.
Summary of Contents for S1C17704
Page 1: ...TECHNICAL MANUAL S1C17704 CMOS 16 BIT SINGLE CHIP MICROCOMPUTER ...
Page 22: ...1 OVERVIEW 1 10 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 42: ...3 MEMORY MAP BUS CONTROL 3 12 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 82: ...6 INTERRUPT CONTROLLER ITC 6 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 108: ...8 CLOCK GENERATOR CLG 8 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 112: ...9 PRESCALER PSC 9 4 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 138: ...10 I O PORTS P 10 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 156: ...11 16 BIT TIMERS T16 11 18 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 208: ...14 8 BIT OSC1 TIMER T8OSC1 14 16 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 234: ...16 STOPWATCH TIMER SWT 16 14 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 242: ...17 WATCHDOG TIMER WDT 17 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 264: ...18 UART 18 22 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 300: ...20 I2C 20 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 320: ...21 REMOTE CONTROLLER REMC 21 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 360: ...24 ON CHIP DEBUGGER DBG 24 6 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 362: ...25 BASIC EXTERNAL WIRING DIAGRAM 25 2 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...