I2CIN command should return 16 bits...
Starting from an example I2C program I want to read the temperature from 2 LM76 chips from National Semiconductor. Some response is generated, so HW and SW work, even from both chips. So far so good.
But the response I get is not the 13Bit data that the chip should send, but only a fraction. And I found out that it is "temperature related", but it is only the MSB part.
My impression is that the I2CIN command is not reading the 13Bit (or more) but only 8Bit.
Is there a programming error? Can the I2CIN read more than 8 bits data?
Thanks,
Arthur
PS. the LM76 datasheet is available at www.national.com
But the response I get is not the 13Bit data that the chip should send, but only a fraction. And I found out that it is "temperature related", but it is only the MSB part.
My impression is that the I2CIN command is not reading the 13Bit (or more) but only 8Bit.
Is there a programming error? Can the I2CIN read more than 8 bits data?
Thanks,
Arthur
PS. the LM76 datasheet is available at www.national.com
Comments
·
·· If you’re trying to get 13 bits, you’ll need to input 2 bytes into your WORD variable.· For example, if you have a word variable called temperature you would need to do something like:
These may need to be reversed depending on which order the device sends the data.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Datasheet page 9
"An inadvertent 8-bit read from a 16-bit register, with the D7
bit low, can cause the LM76 to stop in a state where the SDA
line is held low as shown in Figure 4. This can prevent any
further bus communication until at least 9 additional clock
cycles have occurred. Alternatively, the master can issue
clock cycles until SDA goes high, at which time issuing a
“Stop” condition will reset the LM76."
Before communication or in an event where the chip is not responding you can check for a low SDA line and issue clock cycles until the line is released (HIGH) and then issue a "Stop" condition
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
Thanks very much for the advice! It works perfect. I can continue programming now.
Regards,
Arthur
PS. Metron9, I am aware of the fact that further bus communication might be disturbed, but it didn't. The results were reproducible. But it is a good hint to check for a low SDA; I shall put extra tests in my code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Skype arthurcloet