I2C Protocol Problem
Started by Eppetiano, May 01 2012 09:10 PM
4 replies to this topic
#1
Posted 01 May 2012 - 09:10 PM
Hello all,
please help me with this issue.
I'm using the TMP102 I2C sensor with my netduino plus, i'm using the general I2CBus class but for a reason that don't now why my code is resulting in an exception.
The error screenshot is the first file, listed above. The others are the class files i'm using.
Please help me!! I don't now what i'm doing wrong!
#2
Posted 02 May 2012 - 04:13 AM
Eppetiano, I guess you shoudl specify the address in term of a 7-bit field, because the 8th is reserved for R/W. Try shifting right the current value (0x90) by one bit: 0x48.
Also remember to connect two resistors (e.g. 10k Ohms) between the I2C lines (SCL, SDA) and the +3.3V.
Cheers
Biggest fault of Netduino? It runs by electricity.
#3
Posted 02 May 2012 - 09:11 AM
Thanks for you suggestion, Mario!
Now i'm reading values on byte 1 and byte 2 from temperature register.
Byte 2 = 140
Byte 1 = 19
How can i convert it to a single celsius value, please?
Thanks in advance!
#4
Posted 02 May 2012 - 11:31 AM
I'd try the following:
Cheers
byte t1 = ... byte t2 = ... float temp = (short)(t1 << 8 + t2) / 16.0f;
Cheers
Biggest fault of Netduino? It runs by electricity.
#5
Posted 26 May 2012 - 09:32 PM
Did you get it working? I have my TMP102 working, you can grab that and see what the difference is.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users