The Elektor Forum will close. See also this link. From Friday March 1st it is no longer possible to log in to the forum. However, the content of the forum will remain visible until the end of March. As of April 1st the forum will definitely go off the air.

Code for DS18b20 instead DS1820

The topic on number crunching

Postby niculescu_dann » Fri Dec 26, 2008 12:00 am

I made the great project of "Digital thermostat (080090-11)" from Elektor july_august 2008 ; unfortunate I do not have DS1820 but DS18B20. The temperature show on display is like "xxx.xx 'C" !.
I read this : "In order to convert the HEX code to a temperature value, first you need to identify if you are using a DS18S20, or DS18B20 series sensor. The code to read the temperature needs to be slightly different for the DS18B20 (and DS1822), because it returns a 12-bit temperature value (0.0625 deg precision), while the DS18S20 and DS1820 return 9-bit values (0.5 deg precision)".
Can somebody help me to modify the source for using DS18B20 ?
Thanks in advance !
niculescu_dann
 
Posts: 2
Joined: Thu Jan 02, 2014 10:41 am

Postby Elektor Editor » Mon Dec 29, 2008 12:00 am

Have a look at the project called "Thermo-Snake" from the June 2008 issue. This is based on the DS18B20.

Good luck.

Jan
Elektor Editor
 
Posts: 467
Joined: Thu Jan 02, 2014 10:36 am

Postby niculescu_dann » Thu Jan 08, 2009 12:00 am

I write, based on information from web, four variants of code, for use with DS18B20. Enjoy !
1.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [Temperature.Lowbyte, Temperature.Highbyte]
Convert_Temp:
Dummy = 625 * Temperature
TempC = DIV32 10
TempC = (Temperature & $7FF) >> 4
Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
Temperature = TempC*100 + Float

2.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [RAWTEMP.Lowbyte, RAWTEMP.Highbyte]
Convert_Temp:
dummy = RAWTEMP * 625
TempC = DIV32 100
Temperature = TempC

3.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [Temperature.Lowbyte, Temperature.Highbyte]
Convert_Temp:
TempC = (Temperature & $7FF) >> 4
Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
Temperature = TempC*100 + Float

4.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 0, [Temperature.LowByte, Temperature.HighByte, Skip 4, Count_Remain, Count_Per_C]
Convert_Temp :
Temperature = (((Temperature >> 1) * 100) - 25) + (((Count_Per_C - Count_Remain) * 100) / Count_Per_C)
if Temperature > 32767 then '32767 check if BIT12=1
Temperature= ~Temperature
temperature=temperature>>3 ; divide by 8
niculescu_dann
 
Posts: 2
Joined: Thu Jan 02, 2014 10:41 am

Postby billbar » Thu Jul 07, 2011 12:00 am

niculescu_dannI write, based on information from web, four variants of code, for use with DS18B20. Enjoy !
1.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [Temperature.Lowbyte, Temperature.Highbyte]
Convert_Temp:
Dummy = 625 * Temperature
TempC = DIV32 10
TempC = (Temperature & $7FF) >> 4
Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
Temperature = TempC*100 + Float

2.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [RAWTEMP.Lowbyte, RAWTEMP.Highbyte]
Convert_Temp:
dummy = RAWTEMP * 625
TempC = DIV32 100
Temperature = TempC

3.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [Temperature.Lowbyte, Temperature.Highbyte]
Convert_Temp:
TempC = (Temperature & $7FF) >> 4
Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
Temperature = TempC*100 + Float

4.OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 0, [Temperature.LowByte, Temperature.HighByte, Skip 4, Count_Remain, Count_Per_C]
Convert_Temp :
Temperature = (((Temperature >> 1) * 100) - 25) + (((Count_Per_C - Count_Remain) * 100) / Count_Per_C)
if Temperature > 32767 then '32767 check if BIT12=1
Temperature= ~Temperature
temperature=temperature>>3 ; divide by 8
billbar
 
Posts: 1
Joined: Thu Jan 02, 2014 10:41 am

Re: Code for DS18b20 instead DS1820

Postby germanroot » Fri May 08, 2015 8:42 am

Hi Niculescu,

I hope you can help me.

I like to use the Universal Thermostat 16F628
from 2008-07-08, but the software I can not download
as before in Elektor, if I search for the software 080090-11 or 080090-11.zip,
Elektor only want selling the PCB-Board or the programmed PIC.

I want programming and edit by myself, I have tons of new PIC MCU's
and maybe I can find a programming partner to modify for a new
option.

Please help me to find or download the Elektor software, maybe I can
get the file from you, becuase in the magazine they wrote : free download !!!

My email address is : asiabroadcasting@hotmail.de

I would be happy to get any respons from you, thanks.

Best regards,

Albert Schweitzer
germanroot
 
Posts: 1
Joined: Fri May 08, 2015 8:20 am


Return to Microcontrollers & Embedded

Who is online

Users browsing this forum: No registered users and 2 guests

cron