Ds1820


Closed Thread
Results 1 to 6 of 6

Thread: Ds1820

  1. #1
    puru's Avatar
    puru Guest

    Angry Ds1820

    Beacause of low brain activity I am unable to split the reading from a ds1820 temperature sensor into separate bytes in order to send by radio each byte together with its row and location bytes to serial lcd.
    ***********
    OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]

    ' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)
    temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    LCDOut $fe, 1, DEC (temperature / 100), ".", DEC1 temperature
    ***********
    Thank you very much for any help.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Cool

    Why are you angry ??? DS 1820 is not responsible for any thing here ...

    You use a serial LCD and parallel devices command ... of course it can't work properly.

    Have a little look to serial commands like SEROUT ...

    Alain

  3. #3
    puru's Avatar
    puru Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for you reply but now I realize my post is not clear. The last line of the program I posted is not for the remote display. I do use serout but I'm not able to send temperature, that is a word, divided in multiple one byte. Before each one of these bytes I have also to send the row and location byte.

  4. #4
    puru's Avatar
    puru Guest


    Did you find this post helpful? Yes | No

    Default

    For example if the temperature is 15.78 I have to send: row, location, 1 after that row, location, 5 and so on.

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Assuming temperature is a word size variable and holds a value of 1578 (for 15.78 deg C)

    Use SEROUT2 with the DEC modifier. (See Manual Section 5.71)
    (SEROUT doesn't support modifiers)

    Also have a look at Manual Section 4.17.7
    DIG will solve your problem

    Code:
    SEROUT2,Pin,Mode,[DEC1 temperature DIG 3,DEC1 temperature DIG 2,".",DEC1 temperature DIG 1,DEC1 temperature DIG 0," °C"]
    You will have to add the control-codes for your LCD to the code-example
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  6. #6
    puru's Avatar
    puru Guest


    Did you find this post helpful? Yes | No

    Smile

    Thank you very much Ralph for your solution. Despite all manuals, just now I can see a way to access the innard of temperature variable.
    Bert

Similar Threads

  1. Please help with 1-wire DS1820
    By hatuan291 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th March 2010, 13:51
  2. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 13:12
  3. DS1820 and 18f2550
    By rjones2102 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd October 2007, 18:11
  4. PIC lcd ds1820
    By wchpikus in forum mel PIC BASIC
    Replies: 2
    Last Post: - 24th May 2007, 14:46
  5. DS1820 again
    By paxmowa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th January 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