DS1920 IButton


Closed Thread
Results 1 to 2 of 2

Thread: DS1920 IButton

  1. #1
    Join Date
    Mar 2005
    Posts
    37

    Default DS1920 IButton

    I am trying to communicate with an IButton DS1920. I am using the ONEWIRE.pbp example. According to the datasheet it communicates the same as the DS18S20 or DS18B20. I am able to communicate with the IButton but the temperatures are all over the place. From 32, 84, 112, 225, etc... I am using a 4.7K ohm pull up resistor to 5V. Also tested at 3.6V same results.

    Is there anything special with the DS1920? Has anyone used this and willing to share their success or failures?

    Note: I am only wanting to communicate with just one at a time! No onewire networks!

    Thanks in advance,

    Scott

  2. #2
    Join Date
    Mar 2005
    Posts
    37


    Did you find this post helpful? Yes | No

    Default

    I have found this sample on the forum and would like to see if someone can try this and tell me if this works? I would like to use this on a PIC12F675 or PIC16F628!

    Code:
    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT 
    @ DEVICE pic12F675, WDT_OFF
    @ DEVICE pic12F675, PWRT_OFF
    @ DEVICE pic12F675, MCLR_OFF
    @ DEVICE pic12F675, BOD_OFF
    @ DEVICE pic12F675, CPD_OFF
    @ DEVICE pic12F675, PROTECT_OFF
    
    dEFINE OSC 4
    DEFINE OSCCAL_1K    1   ' osc calibration
    
    Ansel = 0 ' Analog off
    CMCON = 7 ' Comparators off 
    ADCON0 = 7 ' Configure A/D channel
    WPU = %000000 'dISABLE wEAK pULLUPS
    TRISIO = %10010    ' Set all I/O's to outputs
    
    temperature         var word    'DS1820 read Temperature 
    TempNeg      var byte    'temperature sign -/+
    Sign  VAR  BIT
    TempC VAR  WORD 
    
    '*****DS1820 VARS AND SETTINGS*******
    count_remain var byte   'DS1820 coumter of remain bits
    count_per_c  var byte   'DS1820 counter per C bits
    '**********************************
    
    DQ	Var	GPIO.2		' One-wire data pin
    PAUSE 1000
    
    Main:
       GOTO Read_Temp
    
    
    '******DS1820 READING******
    Read_Temp:
       OWOut DQ, 1, [$CC, $44]                ' Start temperature conversion
       waitloop:
       OWIn DQ, 4, [count_remain]	          ' Check for still busy converting
         If count_remain = 0 Then waitloop
       OWOut DQ, 1, [$CC, $BE]		   ' Read the temperature
       OWIn DQ, 0, [temperature.LowByte, temperature.HighByte, Skip 4, count_remain, count_per_c]
    '   SEROUT2 GPIO.0,16468, ["+Raw", IBIN16 temperature,13,10]
       Sign = temperature.15
    '   SEROUT2 GPIO.0,16468, ["SIGN", DEC Sign,13,10]
    '   SEROUT2 GPIO.0,16468, ["+REMAIN", DEC count_remain,13,10]
    '   SEROUT2 GPIO.0,16468, ["+PERC", DEC count_per_c,13,10]
       PAUSE 2000
       
    if (temperature.HighByte = $FF) and (temperature.LowByte <> 0) then
          TempNeg = "-"
          temperature = temperature ^ $FFFF
          temperature = (((temperature >> 1)*100) - 25 + ((count_per_c + count_remain) * 100) / count_per_c)      
    if (temperature.HighByte < $FF) and (temperature.LowByte <> 0) then  
          TempNeg = "+"
          temperature = (((temperature >> 1)*100) - 25 + ((count_per_c - count_remain) * 100) / count_per_c)
          else
    '************************************************
          temperature=$0000    ' THIS IS ONLY NEED TO DEFINE !!!
    '************************************************
    endif
    endif
    	serout2 GPIO.0,16468, ["Temperature: ", TempNeg, DEC (temperature / 100),".", DEC2 temperature, "C ",13,10]
    'return
    goto Main
    
    end
    Thanks for your help,

    Scott

Similar Threads

  1. Efficient comparison on data (iButton)
    By enigma in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th August 2010, 13:37
  2. Writing & Reading to iButton EEPROM
    By crhomberg in forum Code Examples
    Replies: 2
    Last Post: - 6th October 2008, 19:40
  3. Dallas IButton 1990 Presence pulse
    By enigma in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th August 2008, 22:04
  4. How to calculate CRC16 checksum for iButton
    By ashwini kotwal in forum General
    Replies: 13
    Last Post: - 17th March 2008, 19:48
  5. Need IButton Help!
    By scottl in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 10th March 2008, 01:45

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