Negative temp DS1820


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile See this post...

    Hi Fredrick,

    This might help:
    Quote Originally Posted by Darrel Taylor View Post
    Give this a try...
    Code:
    Sign  VAR  BIT
    TempC VAR  WORD
    
    ; read DS1820 here
    
    Sign = TempC.15
    TempC = ABS(TempC)
    TempC =(TempC>>1)*10 + (TempC.0 * 5)
    IF Sign then LCDOUT "-"
    LCDOUT dec (TempC/10),".",dec TempC//10
    <br>
    Quote Originally Posted by sayzer View Post
    It is finally working now for the negative values.

    I did not have this TempC = ABS(TempC) before TempC =(TempC>>1)*10 + (TempC.0 * 5)

    But, now I get correct values.

    Thanks a lot Darrel.
    Regards.
    http://www.picbasic.co.uk/forum/showthread.php?t=4820

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  2. #2
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    How do i import the in my code?

    When i´m trying to import that my display gets crasy, but it can have to do whit my display so i need the full working code so i know if its my OLED or my code that does it..

    I have som problem with my OLED display as u can read in another thread

    EDIT: It works now...
    Last edited by Fredrick; - 19th January 2008 at 04:53.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    How do i import the in my code?

    When i´m trying to import that my display gets crasy, but it can have to do whit my display so i need the full working code so i know if its my OLED or my code that does it..

    I have som problem with my OLED display as u can read in another thread

    EDIT: It works now...
    Having all sorts of problems with that old pirated copy of PBP 2.45 aren't ya?

Similar Threads

  1. Graphic LCD with PICbasic pro
    By amindzo in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th November 2012, 12:45
  2. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 06:07
  3. Random Numbers
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 18th December 2008, 09:47
  4. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 14:12
  5. DS1820 again
    By paxmowa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th January 2006, 15:49

Members who have read this thread : 0

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