Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz

    Jim, Looking at the data sheet, I would change the "SHIFTIN TDAT, TCLK, LSBPRE, [tempIn\9]" statement to "SHIFTIN TDAT, TCLK, LSBPOST, [tempIn\9]" According to the data sheet, the data is valid until the next rising edge of the clock. Also, it takes 750 Milliseconds for each new conversion to complete. I am assuming that your TRS1 and TRS2 port bits are connected to the respective NOT RESET lines on the DS1620's?
    Dave Purola,
    N8NTA
    EN82fn

  2. #2
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz

    Dave,
    I will make that change to the Shiftin statement tonight and let you know if it helps. The TRS1 and TRS2 bits are connected to the respective NOT RESET lines on the DS1620s. This same code worked well on the slower Micro years ago. Maybe reading on the wrong edge didn't have enough of an affect on the slower clock speed, but made the difference at 16MHz. Hopefully that fixes the issue I am seeing. If not, it is always more fun when you have to figure things out.

    Thanks,
    Jim

    Quote Originally Posted by Dave View Post
    Jim, Looking at the data sheet, I would change the "SHIFTIN TDAT, TCLK, LSBPRE, [tempIn\9]" statement to "SHIFTIN TDAT, TCLK, LSBPOST, [tempIn\9]" According to the data sheet, the data is valid until the next rising edge of the clock. Also, it takes 750 Milliseconds for each new conversion to complete. I am assuming that your TRS1 and TRS2 port bits are connected to the respective NOT RESET lines on the DS1620's?

  3. #3
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz

    Dave,
    I tried changing the LSBPRE to LSBPOST as you suggested, but it seemed to make things worse. I changed DEFINE SHIFT_PAUSEUS to 1 and it seemed to make things the closest to the 8MHz Micro as possible (Looking at the timing on a logic analyzer). I can get temp readings, but they are not always reliable. I should also note that the DS1620s are on the end of a cable about 15' from where the micro is. The temp readings seem to be a little low (reading 58F where it should be closer to 69F, however when I try LSBPOST the reading drops in the 40's (Must be dropping a bit or something). Maybe the 18F46k22 can't handle the cable length as the 18F4620 did so well for all these years.
    I will keep it running for a while and monitor the results.

    Thanks for your help
    Jim


    Quote Originally Posted by Dave View Post
    Jim, Looking at the data sheet, I would change the "SHIFTIN TDAT, TCLK, LSBPRE, [tempIn\9]" statement to "SHIFTIN TDAT, TCLK, LSBPOST, [tempIn\9]" According to the data sheet, the data is valid until the next rising edge of the clock. Also, it takes 750 Milliseconds for each new conversion to complete. I am assuming that your TRS1 and TRS2 port bits are connected to the respective NOT RESET lines on the DS1620's?

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz

    Jim, When you have the logic analyzer connected to the PIC pins, are you seeing consistent data between transfers meaning reading to reading? 15 feet is quite a ways for an un-buffered SPI bus. The DS1620 device shouldn't be changing temperature that drastically.
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Reading DS1620 (SPI Temperature) from 18F46k22 Micro at 16MHz

    Dave,
    from one reading to the next, the data does look consistent, but the temp is off which seems weird. I have been logging the results and they are smooth changes in temp. I think it will be a bit easier to follow what is going on with the logic analyzer if I remove the fahrenheit conversion and compare the data read to the bits on the analyzer, but that will be for another day since I don't have the analyzer set up next to where the device is mounted. Maybe then I will be able to see if I am dropping a bit someplace. I may try a different type of Temp IC also (Maybe one that also does humidity)


    Quote Originally Posted by Dave View Post
    Jim, When you have the logic analyzer connected to the PIC pins, are you seeing consistent data between transfers meaning reading to reading? 15 feet is quite a ways for an un-buffered SPI bus. The DS1620 device shouldn't be changing temperature that drastically.

Similar Threads

  1. DS 3231 temperature reading
    By visnja30 in forum mel PIC BASIC
    Replies: 7
    Last Post: - 7th June 2015, 20:50
  2. Max31855 Thermocouple Temperature Reading
    By Lefteris in forum Code Examples
    Replies: 5
    Last Post: - 21st January 2015, 03:20
  3. Replies: 3
    Last Post: - 10th November 2014, 18:20
  4. DS18S20 reading negative temperature
    By srob in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th December 2007, 21:21
  5. DS1620 temperature sensor in high resolution mode
    By crodan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th March 2007, 04:03

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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