The i2c read command reads the specified number of bytes from the specified address. A return value from the command indicates the number of bytes successfully read. Otherwise, the command returns 0x88. This error message can occur if the command is unable to find a device, such as an USB interface, and it returns 0x88.
The read command is a very simple and easy-to-use command. Unlike the read command on most other devices, the read command on an i2c device only returns a single byte. The command doesn’t even need to be a full command. The only thing that it needs to be is a read command.
In the command set of the i2c command, the read command has only one parameter, the data byte. The device expects the data byte to be at the beginning of the command’s command byte. If the read command finds nothing, it returns 0x88. On most i2c devices, the data byte is 0x0, and on i2c devices with a command byte of 0x1, the data byte is the first byte in the command byte.
The reason the command is there is because the command read byte is the one that gets entered. In the command set of the i2c command, the read command has only one parameter, the data byte. The device expects the data byte to be at the beginning of the commands command byte. If the read command finds nothing, it returns 0x0. If the command finds nothing, it returns 0x88.
For this one, we’re using the very popular i2c command set to read two words from the data register. Each word contains four bytes, the first two bytes of the address byte, and the second two bytes of the command byte. The i2c command set reads two words at a time, so all we’re doing here is doing a read for the first byte in the second word.
Our little i2c command set looks like this: i2c read word 0x0 0x88 0x00 0x80 0x00 0x00. This is the same as a simple write, and will return 0x88. The first byte in the second word of the address byte is the first byte of address. The second byte of the command byte is the second byte of the command.
All the words read are the same, so all were at the same location. We also see the same command reads the second word and the first byte on the command byte. No, they are the same, except they are different characters. We all know what they are.
This is one of those situations where you don’t need a complex debugger to figure out what the problem is. A simple program check if it’s the same as the code written before.
The third and fourth bytes read are the same as the first three, but the fourth byte reads the same. We can see that we do not have the same command. We read as if we were reading the first two bytes of command. It’s not like we’re trying to see what’s going on behind the scenes of this game. We’re just reading the first byte.