Then the line would be wrong. The Control Byte depends on the device you're talking to, different devices from different manufacturers can and do have different Control Codes. Refer to the DATASHEET of the device you're playing with.1. It would only take a line to explain that the Control byte always starts 1010
In the PBP Manual 'xxx' is only given as 'don't care' for the 24LC01B and 24LC02B. It's NOT listed as 'xxx' for any others in the table. If you refer to the DATASHEET of those devices you will discover those Address Lines DON'T WORK. This is NOT the case for other (larger) devices and in those cases 'xxx' correctly isn't listed. The PBP manual is concise and correct in this respect. Once again if you missed it from point 1 above... Refer to the DATASHEET of the device you're playing with. The only thing that should be remembered is that the CONTROL BYTE should be a VARIABLE and NOT a Constant.In the examples, the Control byte for the smaller chips is given as %1010xxx0 and x means 'don't care.' It does matter is your chip has a hard wired address. e.g
A2 to G, A1 to G, A0 to VCC - xxx becomes 001.
A2 to VCC, A1 to G, A0 to G - xxx becomes 100 etc.
No, the PBP Manual states that you should use a WORD if addressing a device that requires a WORD, and a BYTE for any device that requires a BYTE. If you use a CONSTANT, and that CONSTANT has a value which is less than 256 (ie it fits into a BYTE size), the compiler may allocate you a BYTE as that CONSTANT, which if you then go and use that BYTE in a situation where a WORD is expected, you're going to wreck your day.3. Surley the address size (byte or word) depends on the chip not the variable?
Actually, other than stating the Control Byte should be a variable I2CREAD & I2CWRITE is well documented.It took me 2.5 days to arrive at my present 'thin' understanding - this seems par for the course with this command.
See aboveIf I still have some of the above wrong - please reply.
So, in summary... READ the PBP MANUAL... READ the device DATASHEETS. You're only going to have yourself to blame if you don't follow the rules.
Bookmarks