Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

I2C Protocol Problem


  • Please log in to reply
4 replies to this topic

#1 Eppetiano

Eppetiano

    Member

  • Members
  • PipPip
  • 10 posts

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!

Attached Files



#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

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 Eppetiano

Eppetiano

    Member

  • Members
  • PipPip
  • 10 posts

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 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 02 May 2012 - 11:31 AM

I'd try the following:
byte t1 = ...
byte t2 = ...
float temp = (short)(t1 << 8 + t2) / 16.0f;

Cheers
Biggest fault of Netduino? It runs by electricity.

#5 mekros

mekros

    New Member

  • Members
  • Pip
  • 7 posts

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

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.