DS1820 versus DS18S20


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gadelhas View Post
    I think it's beacuse i'm using the DS18S20P. Can somebody confirm this?
    I think that means it uses "Parasitic Power" only.

    If so, you have to drive the DQ line HIGH for 750ms during the conversion.
    After that you can read it like normal.
    It doesn't get power from the VDD pin.
    DT

  2. #2
    biggej's Avatar
    biggej Guest


    Did you find this post helpful? Yes | No

    Default More time needed for conversion

    DT is on the right track but maybe for not exactly the right reason. The DS18S20 does not have to run with parisitic power but it can if needed. However this from Maxim..
    "Specification Differences: The primary specification difference between the two parts is the temperature conversion time: DS1820 = 500ms (max) and DS18S20 = 750ms (max)."

    I believe you may also be using "count remain" improperly to signal the end of conversion. End of conversiion may be determined by issing a "Read time slot" command until the result is non zero. (Yes, it is in the data sheet!) All that being said, you can probably get by with only adding the 750ms delay after the conversion command.
    Jim

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by biggej View Post
    DT is on the right track but maybe for not exactly the right reason. The DS18S20 does not have to run with parisitic power but it can if needed.
    The DS18S20 doesn't, but the DS18S20P also called DS18S20-PAR, only uses "Parasitic Power".

    The datasheet ...
    http://datasheets.maxim-ic.com/en/ds/DS18S20-PAR.pdf
    DT

  4. #4
    biggej's Avatar
    biggej Guest


    Did you find this post helpful? Yes | No

    Default Missed that 'P' suffix in the second post.

    I should have know Darrel had it right!
    It will take a wiring change to make Parasitic Power work too.
    Jim

  5. #5
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Ds18b20p

    Thought the following code might interest someone?
    It's based on the code for the DS18B20 by Bruce on the Reynolds/Renton web site.

    The chip I used is the DS18B20-PAR ( the device is marked 'DS18B20P') and will only work with parasitic power. Achieved by using an 2N7000 MOSFET (gate on PORTC.1, source on the DQ line and the drain on +5 supply).

    The DQ line must be driven high within 10uS of the 'convert' command and maintained for the duration of the conversion (750mS for 12 bit conversion).

    The extra code to do this follows the conver command.

    Code:
    ' -----[ Title ]-----------------------------------------------------
    '
    ' File...... WVL Water Remote
    ' Purpose... Remote station for control of water heater
    ' Date...... June 2010
    '
    ' 7. DS18B20P measures tank temp. Parasitic power only with DQ pulled hard
    '    high after 'read temp' command by MOSFET 2N7000 with gate on PORTC.1
    
    ' 8. The DS18B20P range +125C to -55C
    
    ' 9. The DQ line must be high for the conversion period. Periods and resolution:
    '       9  bit   93.7mS     0.5C        1/2  degree
    '       10 bit  187.5mS     0.25C       1/4  degree
    '       11 bit  375.0mS     0.125C      1/8  degree
    '       12 bit  750.0mS     0.0625C     1/16 degree
    '    12 bit resolution used so conversion delay is 750mS and conversion factor is
    '    625 that gives temperature in 1/10000 degrees C
    
    ' 10. The code is based on the DS18B20 pages at web site REYNOLDS/RENTON
    '
    ' ----[ Includes / Defines ]-------------------------------------------
    '
    clear
    define OSC 20				' Use HSPLL during compilation
    DEFINE LCD_DREG	PORTB	    ' Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT	4		    ' Define first pin of connected to LCD
    DEFINE LCD_RSREG PORTB	    ' Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 2		    ' Define pin used for RS connection
    DEFINE LCD_EREG	PORTB   	' Define PIC port used for E line of LCD
    DEFINE LCD_EBIT	1		    ' Define pin used for E connection
    define LCD_RWREG PORTB      ' Define PIC port used for RW
    DEFINE LCD_RWBIT 3          ' Define pin used for RW
    DEFINE LCD_BITS	4		    ' Define 4 bit communication mode to LCD
    DEFINE LCD_LINES 4		    ' Define using a X line LCD
    DEFINE LCD_COMMANDUS 1500	' Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 44	    ' Define delay time between data sent
    FLAGS=0
    include "modedefs.bas"      ' Include serout defines
    '
    ' ----[ Variables ]----------------------------------------------------
    '
    TempR       VAR word        ' DS18B20P reading. raw data
    TempC       VAR WORD        ' Temp in deg C
    Float       VAR WORD        ' Holds remainder for + temp C display
    
    Heartbeat	var	PORTA.0		' Heartbeat each cycle
    
    DQ          var PORTC.0     ' DS18B20P. Comms
    Pullup      var PORTC.1     ' DS18B20P
    '
    ' -----[ Initialization - PIC ]--------------------------------------
    '
    ADCON1	= %00000110			' All ports digital
    CMCON	= %00000111			' Comparators off. Essential or PORTF won't work
    '
    ' -----[ Identify ]--------------------------------------------------
    '
    LCDOUT $fe,$80,"Water Heater"
    pause 1000
    LCDOUT $fe,1
    '
    ' *****************************************************************************
    ' *                                                                           *
    ' *                         M A I N   P R O G R A M                           *
    ' *                                                                           *
    ' *****************************************************************************
    									    
    Main:	
        GOSUB Get_temp
        LCDOUT $fe,$c0,"Temp  : ",DEC TempC,".",DEC Float
    		
    	toggle Heartbeat
        pause 1000	
    	goto Main	
    	
    ' *****************************************************************************
    ' *                                                                           *
    ' *                         S U B R O U T I N E S                             *
    ' *                                                                           *
    ' *****************************************************************************
    
    
    Get_temp: 
        OWOUT   DQ,1,[$CC, $44]         ' Skip ROM search & do temp conversion
        high Pullup                     ' Turns MOSFET on to make DQ line high
        pause 750                       ' Conversion time for 12 bit reading
        low Pullup                      ' Turn MOSFET off after read temp command     
    
        OWOUT   DQ,1,[$CC, $BE]         ' Skip ROM search & read scratchpad memory
        OWIN    DQ,2,[TempR.Lowbyte,TempR.Highbyte]' Read two bytes / end comms
    
    Convert_Temp:
        TempC = DIV32 10                        ' Use Div32 value to calculate precise deg C
        TempC = (TempR & $0FF0) >> 4            ' Mask middle 8-bits, shift into lower byte
        Float = ((TempR.Lowbyte & $0F) * 625)   ' Lower 4-bits of result * 625
      
        RETURN
    
    END
    The MCU is an PIC16F877A running at 20MHz.

    Regards Bill Legge

  6. #6
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Thanks to everyone,

    I i'll try the code and circuit that Bill Legge posted.

    Regards
    Gadelhas

  7. #7
    Join Date
    Aug 2010
    Posts
    4


    Did you find this post helpful? Yes | No

    Default ds1820

    hi im elie,im doing my final project :temperature regulator system
    im newer in the picbasic pro
    i need to know a code t read the tempeature from the sensor ds1820
    thank you all for your replys

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