
Originally Posted by
Eugeniu
Look here , is what I have tried :
adr = 22
i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature.LOWBYTE dig 4+48 ]
....and so on and so on....
Right. I understand what you are trying to do, with the EEPROM and the LED matrix's and such. It's a relatively common project.
What you aren't understanding is that you are only writing ONE BYTE at a time with those statements, not 3 at a time as your changing addresses would indicate.
And one other thing is 'precedence'. I'm not sure if it's applicable in this case, but...
In your statement above...
Code:
i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature.LOWBYTE dig 4+48 ]
How does that get interpreted?
Assume temperature.lowbyte = 123
You are trying to retrieve the 4th (actually 5th) digit of a byte value to which there can only be 3 digits.
Another thing, still assuming temperature.lowbyte = 123, and assume that 'dig 4' is actually 'dig 0'...
Will that statement return "3" + 48 or does it try to return the 52nd digit of temperature.lowbyte?
A better way to put that statement might be:
Code:
i2cwrite I2CDAT, I2CCLK, $A0, adr,[ ( temperature.LOWBYTE dig 4 ) + 48 ]
And again, trying to retrieve the 4th digit of a 3 digit value (at most) won't work...
Since you have obviously modified your program, could you post the whole thing again, including all the relevant information, PIC type, hardware setup, etc.etc.
Bookmarks