PICmicro & dsPIC >> PICmicro & dsPIC

Pages: 1 | 2 | >> (show all)
matc
stranger


Reged: Jun 29 2009
Posts: 6
Loc: Sydney, Australia
DS18B20 - PIC16F628 1 wire help!!! for major work..
      #119052 - Wed Jul 01 2009 04:11 AM

i am in dire need of some source code or examples for a DS18B20 one wire thermometer. i need the code for use with a 4MHZ 16F628. i cant find anything of use in Hi-Tech C and am at a dead end. i need this for my final year major work. this is interfaced with a nokia 3310 lcd. i all ready have others inputs/ouputs working perfecting to retrieve settings but i need the temp settings!

Post Extras: Print Post   Remind Me!   Notify Moderator  
mikerjModerator
Guru
****

Reged: Oct 19 2003
Posts: 1482
Loc: Devon, UK
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119062 - Wed Jul 01 2009 06:52 AM

As long as you have a reasonably accurate delay function, implementing the one wire protocol is not difficult. This project uses the DS1821 which is similar, but I strongly suggest you read the datasheet and familiarise yourself with the one wire protocol rather than blindly implementing other peoples code or you will have no chance in debugging it.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3872
Loc: Colorado
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119072 - Wed Jul 01 2009 07:48 AM

There's a bunch 1-Wire example code in C and even PIC assembler on the Maxim website ready for you to adapt.

Post Extras: Print Post   Remind Me!   Notify Moderator  
matc
stranger


Reged: Jun 29 2009
Posts: 6
Loc: Sydney, Australia
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: Dan Henry]
      #119102 - Wed Jul 01 2009 07:19 PM

thats the problem i have tired implementating code from the maxim website as well as all other examples i can find, only problem is i am very new to the programming environment and this is my first time progrmamming a pic. my main problem is with code implementation. i can understand it, but have trouble converteing it to hi-tech c because of how new i am to it. anybody have pre-written examples in hi-tech c that i could use as a starting point?? (i already tried the one on the mircochip website).

Post Extras: Print Post   Remind Me!   Notify Moderator  
swanny
enthusiast


Reged: Sep 12 2008
Posts: 247
Loc: New Zealand
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119112 - Wed Jul 01 2009 08:22 PM

Sounds like you need to have a bit more of a play around first. Flash some leds, use some timers to flash leds, do stuff on interrupts etc etc. You'll need to familiarise yourself with the datasheet. Most 'variable' names are the same in htc as they are in the datasheet (and the ones that aren't can be figured out by looking in the compiler header for your device).

Is this a uni project? Maybe your supervisor has some code examples you can have a play with.


Post Extras: Print Post   Remind Me!   Notify Moderator  
matc
stranger


Reged: Jun 29 2009
Posts: 6
Loc: Sydney, Australia
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: swanny]
      #119132 - Wed Jul 01 2009 08:56 PM

ok will do. its not a uni project, its a final year electronics major work for my hsc (high school). ive basically built a media centre out of an xbox from scratch, (ie designed my own modchip and contrl circuits). the nokia lcd is the final part and is just showing various outputs (i.e bios setings, hdd read/write sequences). The last step was this temp sensor, to stop it from overheating, but i keep hitting a wall. i have about 3 years programming experience but as this is my firt real pic project, some of the concepts are still a bit out of reach. one more question though, do i need to setup the inbuilt timers on the pic? i already have the watchdog timer, etc disabled, i have a feeling that something in interfering with the timer1, timer2 or whatever they are called.

thanks for all the help so far.


Post Extras: Print Post   Remind Me!   Notify Moderator  
mikerjModerator
Guru
****

Reged: Oct 19 2003
Posts: 1482
Loc: Devon, UK
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119142 - Thu Jul 02 2009 04:32 AM

Quote:

(i already tried the one on the mircochip website).




And what was the result?


Post Extras: Print Post   Remind Me!   Notify Moderator  
matc
stranger


Reged: Jun 29 2009
Posts: 6
Loc: Sydney, Australia
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: mikerj]
      #119152 - Thu Jul 02 2009 04:40 AM

either doesnt output anything or crashes, however this may be an issue with the library i am using to print to the 3310 screen. the main print function ( nokia_printmessage(char*message)) obviously only allows the input of characters so i tried sending the intergers in bytes to the screen using a send byte function, but still no output or a crash! still need to play around a bit. if anyone would be kind enough to take the time to have a quick look at my code and the resulting libraries i will be happy to post it. cheers

Edited by matc (Thu Jul 02 2009 07:32 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Neil_K

***

Reged: Mar 09 2005
Posts: 960
Loc: NY,USA
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119172 - Thu Jul 02 2009 10:06 AM

Do you have access to an oscilloscope?

Post Extras: Print Post   Remind Me!   Notify Moderator  
swanny
enthusiast


Reged: Sep 12 2008
Posts: 247
Loc: New Zealand
Re: DS18B20 - PIC16F628 1 wire help!!! for major work.. [Re: matc]
      #119192 - Thu Jul 02 2009 06:15 PM

You need to format the integers as a string to display them on your screen.

Depending on what sort of numbers you have you may choose to do this yourself or use some kind of library function.

Seen this:
http://www.electronics-lab.com/projects/mcu/013/index.html
I particularly like the way you adjust the contrast for your display

Might have to get one of those LCDs to have a play with.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | >> (show all)



Extra information
1 registered and 29 anonymous users are browsing this forum.

Moderator:  mikerj, jtemples, jeff, Dan Henry, Andrew L 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 1996

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5