DS18B20 sensor with PIC

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

DS18B20 sensor with PIC

Postby kanza » Mon Feb 09, 2015 6:03 pm

hi,
I'm trying to implement the following code in proteus using the same PIC16F877A. I don't have the cytron SK40C with me right now so I decided to first implement the code in Proteus.

http://tutorial.cytron.com.my/2012/11/0 ... re-sensor/

however, when i tried using the hex file in the download link on the page below, i had some weird problem with the temperature value. please see the attached proteus snapshot (ds18b20_pic.jpg).I was wondering if there is anyting wrong with the circuit schematic since the original code has been tested on SK40C. and I am trying to simulate it on Proteus.

I also tried adding a reset button on the RB0 line (which is also connected to the circuit). but when i tried to reset it, it gave a wrong temperature value on the LCD. see thew second proteus snapshot(ds18b20_reset.jpg

I would be grateful if someone can help me with the schematic since the hex file is the same as in the cytron tutorial.

thank you.
Attachments
ds18b20_pic.jpg
ds18b20_reset.jpg
when the reset switch on RB0 is pressed, a wrong temperature value appears
kanza
Freshie
 
Posts: 4
Joined: Mon Feb 09, 2015 5:27 pm

Re: DS18B20 sensor with PIC

Postby ober » Tue Feb 10, 2015 8:50 am

There are 2 schematic shared by you, though I am not familiar with protues (actually none of Cytron is familiar with protues), the 1st schematic seem to be not complete particularly the VCC of 18B20, why is the Vcc is connected to RB0 via a push button; can take reset the sensor? And is that correct way ?

As for 2nd schematic, you wanted to pull the DQ line to GND via a push button, that I assume is to reset the 18B20, you are right for that, but DQ line is connected to RB0 which is controlled by PIC for 1 wire communication. When you press the button, you also short the RB0 to GND and it can happen in the middle of communication, and further corrupt it.

I don see why you need to reset the 18B20 using a push button, it should be come the RB0, just make the RB0 become low from PIC (not external) to reset the 18B20 if that is require to reset it.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: DS18B20 sensor with PIC

Postby kanza » Tue Feb 10, 2015 6:32 pm

i added the reset button only to check my circuit. you can consider it a dummy switch too. if you don't press it, it won't afffect the circuit in my way.
the two schematics only shows the difference in simulation.

even if there is no reset switch on RB0(say i don't use it at all), the result appearing on LCD is the same as first schematic.....why doesn't the temperature reading appear. As I am using the cytron hex file already tested on SK40C, what can i change in the schematic?
kanza
Freshie
 
Posts: 4
Joined: Mon Feb 09, 2015 5:27 pm

Re: DS18B20 sensor with PIC

Postby kanza » Tue Feb 10, 2015 10:44 pm

i simulated the code after getting ready of the push-button. still there is no change in the results on the LCD. what can i do to fix this problem?
Attachments
ds18b203.jpg
temperature value missing
kanza
Freshie
 
Posts: 4
Joined: Mon Feb 09, 2015 5:27 pm

Re: DS18B20 sensor with PIC

Postby ober » Tue Feb 10, 2015 11:48 pm

Maybe you can approach Proteus to verify it as the hex code in tutorial is tested.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: DS18B20 sensor with PIC

Postby kanza » Wed Feb 11, 2015 11:18 pm

is there a way that i can get the sensor timing specifications form the programmer or the author of the tutorial?

time pulse delay high 30us
time pulse delay low 120us
time reset low 480 us
time slot 120us
conversion time 750ms
data write time 10ms


these are the specification that I'm currently using in my simulation. are these according to the program hex file in the tutorial??? My aim here is to find the write schematic for the hex file.
kanza
Freshie
 
Posts: 4
Joined: Mon Feb 09, 2015 5:27 pm

Re: DS18B20 sensor with PIC

Postby ober » Fri Feb 13, 2015 5:36 pm

The tutorial is developed by intern student few years ago.

You can actually check the code as it is open source. Even if I am programmer, I will still need to refer to the source code, it is not possible for us to remember the timing of the code I wrote few years ago.

That is the whole purpose of writing tutorial, you need to study it too.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 5 guests

cron