All data written to the transmit buffer is decoded by this module, and will generally instruct data to be written, or read from a I2C slave node. An ASCII text based message protocol is used.
Command | Format | Description |
0-9 A-F | ASCII HEX |
A 8 bit value represented in ASCII HEX format. |
S | S |
Put a I2C Start condition on the bus. |
P | P |
Put a I2C Stop condition on the bus. This command returns the I2C bus to the idle state. You should always leave the bus in this state when finished with a command. |
R | Rnn |
Reads given number of bytes from I2C slave node. Where 'nn' gives number of bytes to read in a 2 digit value. For example, R05 will read 5 bytes from I2C bus. The I2C bus can not be idle when issuing this command, and must be preceded by a S (I2C Start Condition) command. |
W | Wxx |
Writes a single byte to the I2C bus. Where "xx" represents a byte in two-digit upper case hex format. For example, W1F will write 0x1F (31 decimal) to the I2C bus. The I2C bus can not be idle when issuing this command, and must be preceded by a S (I2C Start Condition) command. |
S5A10P
Writing "Hello" to an I2C node with address 25
S2548656C6C6FP
<[I2C Start][Address:0x5A][Data:0x48, 0x65, 0x6C, 0x6C, ox6F][I2C Stop] This commands sends and I2C message, beginning with a I2C Start condition, and ending with an I2C stop condition. The ASCII string "Hello" is sent. Each character has to be sent with it's ASCII code.
Reading two bytes from an I2C node with address 51
S5102P
<[I2C Start][Address:0x51, R/W = Read][Number of bytes to read: 02][I2C Stop] This commands sends and I2C message, beginning with a I2C Start condition, and ending with an I2C stop condition. Two bytes are read from the I2C node with address 0x51 (or 0x50 for reading).
Repeated Start, write 1 byte (0x15), reading 3 bytes from an I2C node with address 2A (or 2B for writing)
S2A15 S2B03P
<[I2C Start][Address:0x2A, R/W = Write][Data: 0x15] [I2C Repeated Start][Address:0x2B, R/W = Read][Number of bytes to read: 03][I2C Stop] This commands uses the I2C repeated start feature. If a second start command is sent, without sending a stop command, it will cause a repeated start condition to be put on the I2C bus. A single byte is written to the I2C node with address 0x2A, and 3 bytes are read from the I2C node with address 0x2B.