Content originally posted in LPCWare by bruno on Tue Mar 20 13:52:53 MST 2012
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f](1) If it's a I2C write only, the number of bytes to be written is I2CWriteLength, I2CReadLength is zero, the content will be filled in the I2CMasterBuffer. [/COLOR][/SIZE]
[/COLOR][/SIZE](2) If it's a I2C read only, the number of bytes to be read is I2CReadLength, I2CWriteLength is 0, the read value will be filled in the I2CMasterBuffer. [/LEFT]
[LEFT]//Write[/LEFT]
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* I2CWriteLength = 5 ;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CReadLength = 0;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[0] = PCF8594_ADDR;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[1] = 0x03;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[2] = 0x00;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[3] = 0x00;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[4] = 0x01;[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#3f7f5f]I2CEngine(); */[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]// Read[/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][SIZE=2]I2CWriteLength = 0;[/SIZE][/SIZE][/COLOR][SIZE=2]
[SIZE=2][COLOR=#3f7f5f]I2CReadLength = 5;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[0] = PCF8594_ADDR | RD_BIT;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[1] = 0x03;[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[2];[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[3];[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]I2CMasterBuffer[4];[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#3f7f5f]I2CEngine();[/COLOR][/SIZE]
[/SIZE][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE]
I'm not able to read the data correctly. Where is my logic wrong?