I have found lots of threads about this and I have tried some code which gave me different values but the closest I can get to the real thing was from Bruce Reynolds.
I have one sensor which I was able to read its 64 bit serial code.
I adapter Bruce's code to display on an 2 line LCD using Darrel Taylor's LCD_AnyPin.
I have added a status LED that blinks every .5 sec to let me know the readins are happening and all I get is "T= +85.0 C "
I tried squeezing the sensor between my fingers, I tried to bring the soldering iron close to the sensor for a few seconds but no change.
If I pull out the sensor from the breadboard I get "T= -00.000 C"
I've tried using a bad 64 bit serial code to see what happens and doing so I get "T= -00.000 C" with or without the sensor present.
At this point I am wondering if my sensor is bad or if I missed something in the code...
Here is my code:
Code:
@ __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
clear
DEFINE OSC 4
CMCON = 7           
OPTION_REG = 0
INTCON = 0

LCD_DB4   VAR PORTB.0
LCD_DB5   VAR PORTB.1
LCD_DB6   VAR PORTB.2
LCD_DB7   VAR PORTB.3
LCD_RS    VAR PORTA.4
LCD_E     VAR PORTA.3
LCD_Lines     CON 2    ' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
LCD_DATAUS    CON 50   ' Data delay time in us 
LCD_COMMANDUS CON 2000 ' Command delay time in us 

INCLUDE "LCD_AnyPin.pbp"  ; *** Include MUST be AFTER LCD Pin assignments ****
PAUSE 500 : LCDOUT $FE,1 : PAUSE 250

;LCDOUT $FE,$80, "Display line 1"
;LCDOUT $FE,$C0, "Display line 2"
;DEFINE  LOADER_USED 1   ' Boot loader is being used

StatLED     var porta.1
Sign        VAR BYTE        ' + or - temp indicator
ID          VAR BYTE[8]     ' Array storage variable for 64-bit ROM code
Deg         CON 223         ' Data to display "Deg" symbol
DQ          VAR PortB.5        ' One-wire data pin "DQ" on PortC.0
Busy        VAR BIT         ' Busy Status-Bit
Raw         VAR WORD        ' RAW Temperature readings
TempC       VAR WORD        ' Temp in deg C
TempF       VAR WORD        ' Temp in deg F
Float       VAR WORD        ' Holds remainder for + temp C display
Cold_Bit    VAR Raw.Bit11   ' Sign-Bit for +/- Temp. 1 = Below 0 deg C
Dummy       VAR BYTE        ' Dummy for Div32
sensor      var byte
hexbyte     var byte
col         var byte
 
'-------------------------------------------------------------------------------
'these constants are available to program the sensor for 9,10,11,12 bit resolution
'DS18B20_9bit  CON 011111 ; 93.75ms, 0.5°C
DS18B20_10bit CON 111111 ; 187.5ms, 0.25°C  <-- My favorite
'DS18B20_11bit CON 011111 ; 375ms,   0.125°C
'DS18B20_12bit CON 111111 ; 750ms,   0.0625°C  (default)
'   use the statement below in your program to set the resolution
OWOUT dq, 1, [$CC, $4E, 0, 0, DS18B20_10bit]  'set resolution of sensor
'=================================================================
'============ Main Program loop ==================================
'=================================================================
Main:

    pause 500
    toggle statled

    for sensor=1 to 1       'change this to match how many sensors you are reading
        for hexbyte=0 to 7  'each sensor address is 8 bytes
            gosub getid     'go look up each sensors address
            id[hexbyte]=col 'load the ID array with the retrieved address byte
        next hexbyte        'go get the rest of the address bytes
        gosub readsensor    'now go read the current sensor
        gosub DisplayTemp   'now display the temp of the current sensor
    next sensor             'now go read another sensor
goto main

end                     'end here... use reset button to read them again.
'============= subroutines ========================
ReadSensor:
    OWOUT DQ, 1, [$55,str id\8,$44] 'instructs sensors to match[$55] this[ID] rom code and
                                    'initiates[$44] temperature conversion on matching sensor
CkAgn:
    OWIN DQ, 4, [busy]              ' Check for still busy converting
    IF busy = 0 THEN ckagn          ' Still busy?, then loop
    owout dq,1,[$55,str id\8,$BE]   'instructs sensors to match[$55] this[ID] and start sending back scratchpad[$BE] 
    OWIN DQ, 2, [Raw.LOWBYTE,Raw.HIGHBYTE]' Read two temperature bytes, then end communications
    return
'-------------------------------------------------------------
DisplayTemp:                        ' +32.0 to +257 F 
    IF      Cold_Bit = 1 THEN Cold  ' If Cold_Bit = 1, it's below "0" deg C
    Sign  = "+"
    Dummy = 625 * Raw               ' Multiply to load internal registers with 32-bit value
    TempC = DIV32 10                ' Use Div32 value to calculate precise deg C
    TempC = (Raw & $0FF0) >> 4      ' Mask middle 8-bits, shift into lower byte
    Float = ((Raw.Lowbyte & $0F) * 625) ' Lower 4-bits of result * 625
    LCDOUT $FE,$C0, "T= ",Sign,DEC TempC,".",DEC Float,"C        "
RETURN
''------------------------------------------------------------
Cold:                       ' arrive here if temp is below zero C
    Sign   = "-"            ' Display - symbol for negative temp
    Dummy  = 625 * ~Raw+1' Multiply to load internal registers with 32-bit value
    TempC  = DIV32 10       ' Use Div32 value to calculate precise deg C
    LCDOUT $FE,$C0, "T= ",Sign,DEC TempC DIG 4,DEC TempC DIG 3,".",DEC3 TempC," C "
'   debug "Raw", IBIN16 Raw," Dec  ",(Raw>>3),$0D,$0A
    RETURN
'=============================================================
GetID:
Select Case sensor
        Case 1 :LOOKUP hexbyte,[$28,$05,$EF,$BC,$02,$00,$00,$8C], col
        
        ;add more sensors here 
end select
return
Thanks for pointing me the right way,

Mike