Answer to my question about DS18B20 Readings and commands

General discussion on mikroC.
Post Reply
Author
Message
Carlos
Posts: 12
Joined: 10 Feb 2009 12:34

Answer to my question about DS18B20 Readings and commands

#1 Post by Carlos » 20 Apr 2009 12:14

Hi all
Alain, Roger, drdoug
I have been in holidays and since yesterday I have working on my project.

The problem about the conversion was as we suspected on the timing
of the DS18B20 One Wire Commands of the MKE

I detected that the delays of microC were not correct however I’m using a 20 MHz Xtal
with a PIC 18F2550 with PLLDIV = 5, CPUDIV = OSC1_PLL2 and USBDIV =2.
I don’t understand why the delay are not correct because I’m dividing 20 MHz Clock by 5 to get the standard 4 MHz.

I have done my own functions for RESET, READ and WRITE to the DS18B20 and the delays were adjusted with a scope putting a blinking test on a PORT to determine the value of delays. For instance in my case 480us is Delay_us (1200);
And 60us is Delay_us (200 ); Nearly 3 times.

So all you bee advised of some delay problems in some projects

Now all is working fine. Thank you Alain Roger and drdoug to your hep.

Regards and see you latter

Carlos

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#2 Post by Dany » 20 Apr 2009 14:49

I have a small question: what clock speed did you set in the IDE? (I think in the case you describe it should be 48Mhz.)
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Carlos
Posts: 12
Joined: 10 Feb 2009 12:34

#3 Post by Carlos » 23 Apr 2009 10:30

Yes Dany I see your question Yes it is 48 MHz

In fact my functions are working but I question why the MKE One Wire did’t work.

In fact and unfortunately I did saw that I have the CPUDIV scaler wrong !...

My scaler was in CPUDIV=OSC1_PLL2 and I changed to CPUDIV=OSC2_PLL3 and MKE One wire is working.
And I checked more:
With 25 meters HiFi twisted pair cable it works but with 50 meters there is no readings my bee because the pulse shape.

Finally I put The CPU Clock Postscaler in CPUDIV=OSC4_PLL6 and I got 100 meters HiFI cable readings with 10 DS18B20 sensors in parallel . So my tests indicate that a cable with more than 8 nF of capacity will not measure. It will be necessary to use anther type of twisted pair like the RF 300 ohms line with a very low capacity per meter.
Dany now I have on the PIC18F2550 the following config :
PLLDIV = 5
CPUDIV= OSC4_PLL6
USBDIV =2
XTAL 20.00 MHz
All is working well and the PIC is controlled by a PC with a software using a DataGridView panel.
I will use this project on an ICE Cream shop to monitor and daily register of 57 Freezers on a 3 floor plant. I will use the lower capacity cable possible .
Regards Dany

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#4 Post by Mince-n-Tatties » 23 Apr 2009 11:39

has anyone worked out away to id any sensor in a multi-sensor system such that the position in the chain can be found without having to do any manual work?

i had thought of doing something based on the time to respond, but this is full of variables like, some sensors may (even from the same manufacturer even from the same wafer plant) be slower to respond than others such that last sensor in the line may look to have the same distance as the 2nd last sensor or worse. I still think this could be the approach though as many of the variables which I can imagine are relative rather than absolute.

i know about the device id and how to get it and how to assign any id to a sensor on an LCD / file / to pc for display etc, but typically you would perform a sort of calibration as the system designer to locate the sensor id and then place it in the chain of sensors such that you know its position.

I want this to be completely transparent to end users i.e. some person using the system only need know this is sensor 1 sensor 2 sensor nn etc with no input or calibration required.

WHY... take the stand point that some system end users will have absolutely no ability to perform anything other than to read the temperature from the LCD or PC application, this would include running even a simple calibration like heat/cool (or even fit) one sensor at a time so that the program may assign locations based on id of hottest/coldest (fitted) sensor.

the answer is not to pre-calibrate before handing the system over. this does not provide for replacing dead sensors or scalability.

i have a number of ways to do it based on interaction from end user but want a super smart system.

any ideas greatly appreciated feel free to PM if you don’t want to make it public

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#5 Post by Mince-n-Tatties » 23 Apr 2009 11:48

Carlos wrote: I will use this project on an ICE Cream shop to monitor and daily register of 57 Freezers on a 3 floor plant. I will use the lower capacity cable possible .
Just for interest…

I have seen a system in use by companies which have large scale refrigeration which used a type of X10 based system. Each sensor control system fitted to each fridge had a connection to the mains and as such could inject its information onto the mains line so that it could be collected anywhere in the building (on the same ac phase of course) by a PC (in this case running labview) with mains receiver. This was long before the home mains networking was mainstream.

mlebel
Posts: 58
Joined: 13 Apr 2010 11:55
Location: Karmiel, ISRAEL
Contact:

Re: Answer to my question about DS18B20 Readings and command

#6 Post by mlebel » 11 Sep 2011 11:15

Interested in Smart Home modules?

Try: http://www.onofftech.com

It all been programed with MikroC

Post Reply

Return to “mikroC General”