TCN75 Temp Sensor


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2008
    Posts
    39

    Default TCN75 Temp Sensor

    I want to use MicroChips TCN75 2-wire temperature sensor in a project, but still being a PIC Basic newbie, I am stumped on where to even start. I assume I have to use I2CREAD and I2CWRITE, but from there I do not know where to go.... I am using an 18F8722 Pic.
    Last edited by Frozen001; - 18th September 2008 at 20:27.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Frozen001 View Post
    I want to sue MicroChips TCN75
    That would be a good trick!

    2-wire temperature sensor in a project, but still being a PIC Basic newbie, I am stumped on where to even start. I assume I have to use I2CREAD and I2CWRITE, but from there I do not know where to go.... I am using an 18F8722 Pic.
    First off, you read the datasheet and learn a little bit about the part you want to play with.
    The you take note of any and all addresses that the part might or might not use and/or any data that has to be transferred to and/or from the device depending on what you want to do.
    If you have used any EEPROM devices at all, this device should act pretty much like those...write a location to do something, read another location to get some data back.
    Write some code. Somebody might walk you thru it, somebody might help you figure out what is wrong. However, I'd doubt somebody wil write it for you...

  3. #3
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    That would be a good trick!



    First off, you read the datasheet and learn a little bit about the part you want to play with.
    The you take note of any and all addresses that the part might or might not use and/or any data that has to be transferred to and/or from the device depending on what you want to do.
    If you have used any EEPROM devices at all, this device should act pretty much like those...write a location to do something, read another location to get some data back.
    Write some code. Somebody might walk you thru it, somebody might help you figure out what is wrong. However, I'd doubt somebody wil write it for you...
    Well I am not really a digital guy... more of an RF guy tring his hand at microcontrollers. I looked at the data sheet, and I thnk I see what I need to sent to the LM75, but I think I am more confued with the commands I2CREAD and I2CWRITE.

    After Startup, I have to send 10010001 to go into read mode. The sensor will acknowledge receipt (SDA low). After ACK, the sensor will clock out the data which I have to read.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Frozen001 View Post
    but I think I am more confued with the commands I2CREAD and I2CWRITE.

    After Startup, I have to send 10010001 to go into read mode. The sensor will acknowledge receipt (SDA low). After ACK, the sensor will clock out the data which I have to read.
    Ok, that sounds reasonable...
    YOU don't have to worry about SCL, SDA, ACK, NACK, this, that, the other thing, whatever...
    PBP and I2CREAD/I2CWRITE take care of that for you.
    All you have to do is provide the right parameters for said commands (i.e. addresses, data, etc).

  5. #5
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    OK SO I tried the following:

    I2CWRITE PORTC.4, PORTC.3, $91, $00
    I2CREAD PORTC.4, PORTC.3,$90, [STR Temperature\16]

    And got nothing back...

  6. #6
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    I connected the I2C port up to a scope, and I am getting pulses on the clock and SCL and the SDA pins, so I must be doing something correct... I think my problem is I am just not reading the data.

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Verify that you have 5k resistor as pullup on I2C line. Also verify the address you have set (did you connect a0;a1;a2 to ground). Use write only to configure the chip or to set the setpoints.
    Use Read all the time you want to read out data from your chip. A 10- 15 millisecs delay between reading is recommended.

    good luck

  8. #8
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    OK I have it reading the data correctly, it think:

    I2CREAD PORTC.4, PORTC.3,%10010001 ,$0, [temph,templ]

    temph is the first 8 bits, and templ is the next 8 bits.

    temph is difined earlier as the first byte in the word temp, while templ is defined at the second byte in the word temp.

    Now that I have the temperature reading, is thre a way to convert it to ascii characters so I can send them to my display?
    Last edited by Frozen001; - 22nd September 2008 at 15:30.

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Frozen001 View Post
    OK I have it reading the data correctly, it think:

    I2CREAD PORTC.4, PORTC.3,%10010001 ,$0, [temph,templ]

    temph is the first 8 bits, and templ is the next 8 bits.

    temph is difined earlier as the first byte in the word temp, while templ is defined at the second byte in the word temp.

    Now that I have the temperature reading, is thre a way to convert it to ascii characters so I can send them to my display?
    Look at the modifiers listed in the Serial out routines, HEX, BIN, STR Etc. . . usually, if my poor memory serves me, data goes ascii without the modifiers, but go look at them anyway, also while you are checking those out look also at the DIG and DEC modifiers, they do good things too.
    http://www.melabs.com/resources/pbpmanual/
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  10. #10
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    The modifier would be OK , but my display does not used a serial interface, rather I have to access address for each character to display (HDSP-2112).

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Frozen001 View Post
    I2CREAD PORTC.4, PORTC.3,%10010001 ,$0, [temph,templ]
    temph is the first 8 bits, and templ is the next 8 bits.
    temph is difined earlier as the first byte in the word temp, while templ is defined at the second byte in the word temp.
    Now that I have the temperature reading, is thre a way to convert it to ascii characters so I can send them to my display?
    tempw var word
    tempw.highbyte = temph
    templw.lowbyte = templ
    lcdout $fe,1,DEC5 tempw

    Just like it shows in the LCDOUT section of the PBP manual.

  12. #12
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    tempw var word
    tempw.highbyte = temph
    templw.lowbyte = templ
    lcdout $fe,1,DEC5 tempw

    Just like it shows in the LCDOUT section of the PBP manual.
    Thanks for the information, but the display is not compatible with the LCDOUT routine. I got it working though, had to do some math. Working great so far.

    Thanks again...

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 22:42
  2. Graphic LCD with PICbasic pro
    By amindzo in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th November 2012, 11:45
  3. Using WDT as a Temp Sensor?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 20th June 2006, 17:55
  4. RH/Temp Sensor Example Code
    By Bruce in forum Code Examples
    Replies: 7
    Last Post: - 15th June 2006, 15:55
  5. Temp sensor problem
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 14th June 2006, 14:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts