Shop OBEX P1 Docs P2 Docs Learn Events
BS2pe AND I2C TEMP SENSOR TC74 — Parallax Forums

BS2pe AND I2C TEMP SENSOR TC74

hnilohnilo Posts: 3
edited 2010-06-09 13:09 in BASIC Stamp
Hello!


I've been trying to use the Microchip TC74 I2C temperature sensor with the·BS2pe with no success.·
This is the first time I'm using I2C and I'm struggling... I'd appreciate if somebody could give me some help.
The SDA and SCLK are pulled up with 4.7K resistors and connected to P8 and P9 respectively.
·
These are the addresses I'm using:
·
RW········ CON·· $9A 'device's default address 1001101b and LSB 0b (write)= 9Ah
RD········ CON·· $9B 'device's default address 1001101b and LSB 1b(read) = 9Bh
·
·
to write, as I understand, it would be:
·
ICOUT SDA,RW,command,[noparse][[/noparse]VALUE] ' where command byte can be: 0h read temperature, or·1h read/write configuration
·
to read I see that needs to be done in two steps, but all that I was able to read was FFh.
·
thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 04:53
    You need to use I2CIN to read the temperature register like:

    I2CIN SDA,RD,0,[noparse][[/noparse]value]

    where "value" is the byte variable to receive the data.

    This doesn't check to see whether the conversion of the temperature value to digital is done yet. It looks like it should take a maximum of 250ms to get a new reading from either power on or the previous reading. You could read the configuration register to see when a new reading is available
  • hnilohnilo Posts: 3
    edited 2010-06-09 13:09
    I figured it out. The datasheet states a default slave address, and I made the mistake to assume that it was the right one...

    Thank you
Sign In or Register to comment.