CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

DS18S20 & DS18B20 Codes
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
pyu



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Mar 16, 2009 9:27 am     Reply with quote

Why didn't you use DS18B20 ? It has almost the same price.
Alioshag



Joined: 23 Feb 2009
Posts: 5

View user's profile Send private message

PostPosted: Mon Mar 16, 2009 11:20 am     Reply with quote

I got it as a free sample.
Borke



Joined: 31 Mar 2009
Posts: 1
Location: Novi Sad

View user's profile Send private message

PostPosted: Tue Mar 31, 2009 7:44 am     Reply with quote

I'm having problems with output_high(), output_low(), output_bit(), output_float(), shift_right().... and delay functions. Compiler is not recognizing this functions. I get "undefined symbols" error. I use PIC12f629 and I 've included its .h file. Compiler is HI-TECH STD and I use MPLAB. Where can I find their definitions, or how can I cope with that? Can somebody help me?
bolke



Joined: 16 Apr 2009
Posts: 5

View user's profile Send private message

PostPosted: Fri Apr 17, 2009 3:29 am     Reply with quote

The examples used here are for the ccs compiler, not MPLAB.
You should search for equivelant function in MPLAB.
ishmael



Joined: 02 Jun 2009
Posts: 4

View user's profile Send private message

problem
PostPosted: Tue Jun 09, 2009 1:45 am     Reply with quote

Hello. I have a problem that drives me insane. I am sure it is in simulation or fuses. Both temperature nibbles are always 255, so the result returned from read() is always -0.5. Has anyone else met this problem ?

I attached the pull-up, I use a pic16f648A, and the pin is B5 (or B4, I tried both, no result).

Please help. Rolling Eyes
Shamber



Joined: 16 Jun 2009
Posts: 3

View user's profile Send private message

Alarm Search
PostPosted: Thu Jun 18, 2009 7:26 am     Reply with quote

Hello.
Does anybody help me with alarm search procedure?
jruibarroso



Joined: 07 Jan 2006
Posts: 64
Location: Braga

View user's profile Send private message Send e-mail MSN Messenger

strange behavior on temperatures below zero
PostPosted: Tue Jun 23, 2009 3:13 pm     Reply with quote

When temperatures are above zero (>0º) display shows correct values but when is below 0º (<0º) strange values appears (~65535). Can anyone tell me how can I correct this ?
Code:

temperature = ds1820_read();
printf(lcd_putc,"TEMP: %3.1f ", temperature);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 28, 2009 3:42 pm     Reply with quote

What code did you use ? There are several versions of the driver in
this thread:
1. Han Solo
2. scanan
3. xokolatecake (2nd post)

What sensor did you use ?
A. ds18B20
B. ds18B20-PAR
C. ds18S20

I used the first one, ds18B20, and the original Han Solo code.
I configured the code for the ds18B20, as shown in his post:
Code:
//result = (float) temp3 / 2.0;   // (Commented out) for DS18S20
 result = (float) temp3 / 16.0;  //Calculation for DS18B20 

I got 24.0 degrees C at room temperature. If I use "Chill Spray" to
freeze the ds18B20, then it displays -10.1 degrees C. It's working.
This was tested with compiler vs. 4.093 and a 16F877A running at 20 MHz.
I put the ds18B20 on pin C2. I edited the 1wire.c code to use pin C2
instead of pin A0. That's because on the PicDem2-Plus board, pin A0
is connected to external circuits, but pin C2 is free for use.
xuxa



Joined: 07 Jul 2009
Posts: 4

View user's profile Send private message

display only shows -0.5 C
PostPosted: Tue Jul 07, 2009 8:00 pm     Reply with quote

I am having the same problem of ''ishmael'' and I use CCS in Mplab, I've tried the 16f628a and the 16f877a, both only shows -0.5 C on display...

I'm from Brazil, my english is not perfect, thanks for any help
ishmael



Joined: 02 Jun 2009
Posts: 4

View user's profile Send private message

PostPosted: Tue Jul 07, 2009 11:54 pm     Reply with quote

xuxa, I solved the problem. I'm sorry I haven't posted a follow-up, it's just that the project is my bachelor's degree, and the exam is tomorrow, so I am a bit stressed. As far as I can remember, the -0.5 problem in the proteus simulation got solved when I loaded the proper configuration word onto the pic (from the end of the ccs exported lst file). If necessary, delete and add the pic and/or ds18s20, or even start a new project (maybe there are some bugs regarding applying the changes to those settings). Also pay attention to the oscillator setting, so that the pic speed you used in the C code, will match the speed set up in proteus.


And if your problem is not in simulation, remember to attach the pull-up resistor to the 1-wire bus. Upon checking my original post, I discovered I changed the port to, it's RA6 used as I/O , - pic uses internal oscillator. try using my fuse list : NOWDT, INTRC_IO, MCLR, PUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD
config word : 0x3F70


Hope it will work for you too.
xuxa



Joined: 07 Jul 2009
Posts: 4

View user's profile Send private message

-0.5 C problem
PostPosted: Wed Jul 08, 2009 3:03 pm     Reply with quote

In the project with 16f877A, I solved the problem using the same oscillator setting as I 've been using in my CCS code (20Mhz). Than the LCD only displayed multiples of 8, like: -16 C, -8 C, 0 C, 8 C, 16 C .....So I went to the ds1820.c code and changed the configuration to ds18B20, in a escale of 0.1 , (just by changing the comment of two lines):
Code:

//result = (float) temp3 / 2.0;   //Calculation for DS18S20 with 0.5 deg C resolution
   result = (float) temp3 / 16.0;  //Calculation for DS18B20 with 0.1 deg C resolution
 

So....it worked fine in simulation!

To the 16f628A project, it worked too, but the configuration of the fuses and the clock are :
Code:
#use delay(clock=4000000)

#fuses NOWDT, HS, PUT, NOPROTECT, BROWNOUT, MCLR, NOLVP, NOCPD
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP,NOMCLR


Thanks very much!
I will try it on Protoboard next month, bye
milkman41



Joined: 16 Jun 2008
Posts: 30

View user's profile Send private message

PostPosted: Fri Mar 05, 2010 3:01 pm     Reply with quote

Hi all,

I'm using the original code posted by Han Solo on the first page, and I can't get a temperature other than 85 C, which I think I read was the startup temperature. I'm using a PIC16F876A with a DS18B20. The code I'm using is pretty much exactly the one Han Solo posted; all I've changed is the one wire pin, and then made some minor changes to the main code, but nothing to any of the actual one wire functions. Any help would be greatly, greatly appreciated.

thanks.
deperkin



Joined: 04 Feb 2009
Posts: 83
Location: PA

View user's profile Send private message Send e-mail

ds18s20
PostPosted: Mon Sep 20, 2010 1:56 pm     Reply with quote

I am trying to connect a ds18s20. (I am using a 4.7k pullup).

I am using the original hans solo code, with the only difference that the clock is set to 500 kHz. And I am trying to use pin D2 on an 18F4550.

I also am constantly reading a -0.5 C temperature.

Any ideas? Due to other things on the circuit I need to stick with this clock speed.

I am using compiler 4.093 as well.

I am NOT using Proteus.

If I use the updated code from http://www.ccsinfo.com/forum/viewtopic.php?t=42648&highlight=ds1820
then I constantly get 4095.0 C

I have also tried various input pins.


Thanks all!
atai21



Joined: 30 Dec 2010
Posts: 31

View user's profile Send private message

PostPosted: Tue May 10, 2011 1:49 am     Reply with quote

I'm sorry but I don't understand what this line means:
Code:

setup_adc_ports(no_ANALOGS);

Does it mean I can't put analog in my code? If I want to measure voltage from solar cell, I need to connect it with pin A3. Can someone help me?
tejca



Joined: 16 Sep 2011
Posts: 2
Location: SLOVENIJA

View user's profile Send private message

PostPosted: Mon Oct 03, 2011 2:34 pm     Reply with quote

atai21 wrote:
I'm sorry but I don't understand what this line means:
Code:

setup_adc_ports(no_ANALOGS);

Does it mean I can't put analog in my code? If I want to measure voltage from solar cell, I need to connect it with pin A3. Can someone help me?


it means analog-digital converter on specific ports are disabled and yes that part of code means you can not put analog on pins which have that converter.
_________________
--
Not Found (aka 404)

You're looking for something that does not, has not, will not, might not or
must not exist ...
... but you're always welcome to search for it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group