
S1S60000 Technical Manual
Rev.1.5
EPSON
31
(2)
I2C
When controlling I2C master function, specify “I2C” in Target segment and the control data row in Data segment.
Destination segment is not provided.
In the control data row, you can specify the value to be output to I2C bus and the restart timing as well as the
timing at which input from I2C bus is to be received and the byte count used.
Control data row is coded as
shown below.
Table 5.5
I2C Control Data Row Coding Method
Element of control data row
Designation method
Slave addressing
Beginning of control data.
This addressing must be done after
restart.
In case of 7-bit addressing, set bit[7:1]=Adr[6:0] and specify R/W bit
(1:Read, 0:Write) for bit0.
In case of 10-bit addressing, set the first byte’s bit[7:3]=“11110” and
bit[2:1]=Adr[9:8], and then set R/W bit (1:Read,0:Write) for bit0.
In
the second byte, set bit[7:0]=Adr[7:0].
Value to be output to I2C bus
2 digits hexadecimal numbers “00” to “FF” for each byte
Restart timing(*1)
“SR”
Input timing from I2C bus and byte
count used (*1)
“LN” and succeeding 2 digits hexadecimal numbers “01” to “08”
*1: It can be coded more than once in the same control data row.
In the control of I2C master function, the return value takes one of the following values.
Table 5.6
I2C Control Data Row Coding Method
Return value
Result of control
“ERROR”
Requested control was not completed.
Hexadecimal number x2 (byte count
specified with “LN”) digits
Completed every requested control and received input from I2C bus.
“OK”
Completed every requested control.
For writing, the R/W bit is turned to Write and an index is specified at the addressing time and then data is
specified. On the other hand, the following procedures are necessary for reading after index specification.
(1) Specify an address. Turn the R/W bit to Write.
← For “writing” an index.
(2) Specify an index.
(3) “SR”
← For selecting a read state while holding the index.
(4) Specify an address. Turn the R/W bit to Read.
← For “reading” data.
(5) Specify the read length with “LN.”
When the return value is expressed in hexadecimal numbers and the byte count specified with “LN” is 2 or
greater, the byte first received from I2C bus is arranged in the upper digit and the byte received the next is
arranged in the lower digit.
Following describes examples of access (following applies to the device where the
data that succeeds addressing as an index).
[ Example 1 ]
When writing 2 bytes long data (01h, 02h) from Master at IP address 192.168.1.1 to index 0 of
7bit Slave address 02 device.
URI:
http://192.168.1.1:8080/I2C?04000102
Response: <DIV NAME=“DEVICE-VALUE”>OK</DIV>
[ Example 2 ]
When reading 3 bytes long data at index 0 of 7bit Slave address 02 device from Master at IP
address 192.168.1.1.
URI:
http://192.168.1.1:8080/I2C?0400SR05LN03
Response: <DIV NAME=“DEVICE-VALUE”>000001</DIV>