SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By hcker2000
#6483
I'm trying to figure out how to use a pic16f88 to read a ds1820 temp sensor. In the end I would like to be able to read like 10 of them. Here is a general program over view.

Pic recives command to get temps from pc (over the serial port)
Pic talks to ds1820's
pic sends data back to the pc.

Thats all I need to do. So if some one can help me figure it out that would be great.

I need to know the fallowing.

1. how to hook the max232 level converter ic to the pic16f88
2. how to talk to the ds1820's
3. how to send and recive commands with the max 232.
By jayjay
#6500
Hi

If your main objective is to be able to read multiple 1820's then you can get the DS9097 1-Wire serial adapter and hook it up to the PC's COM port. You can use the 1-Wire viewer from Dallas or the 1-Wire public domain kit. This option does not require a PIC or any MCU.

If you do need to use the a PIC, then look into 1-Wire protocol example code at the PIC list. Then ckeck out the appnote www.maxim-ic.com/appnotes.cfm/appnote_number/2420 titled 1-Wire Communication with a Microchip PICmicro Microcontroller.

HTH
Jay
By hcker2000
#6508
I was thinking of doing that as well. I also have the ds2490 that i beleave are 1-wire to usb chips. I havn't had a chance to test them as I dont have a 12mhz crystal laying around.
By wiml
#6517
For that matter, Dallas/Maxim will sell you a pre-built RS232-to-1wire dongle based on the '9097. (They probably sell the USB-to-1wire things as well.) IIRC, the price is competitive with buying the chip and putting the dongle together yourself.
By hcker2000
#6527
Well the usb to 1-wire is about $22-$25 + shiping. Not to mention they are hard to come by (especialy the serial ones ). The ic that is used for it can be sourced for free from dallas. Now I just got to see if radio shack has a 12mhz crystal.

Thanks to the link for the serial interface though I will definitly check it out.
By jayjay
#6533
Hi

I do have code for low level 1-Wire protocol in C originally targeted at a MSP430 processor, it can be ported to other MCUs. I used it to communicate with iButtons/ DS2450 etc. It does not implement the higher layers just the bare basic 1-Wire timing waveform via bit-bang. If yer interested lemme know.

Btw, you may wan to sample the DS2480 from Dallas as well, thats the RS232->1-Wire driver chip, also used in 9097 adapters.

Cheers
Jay
By hcker2000
#6552
Sure the code would be great the I'm not sure if I will be able to do the porting to pic asm or not.

The target pic is a 16f88 because it will be easy to use for the serial portion of the project.

If I could get this usb chip going then I guess I dont need the pic. All I need to do is be able to read the temps out on a pc. USB is prefered because I am runing out of serial ports. I can always buy more usb to serial adaptors but that costs me :D
By jayjay
#6554
Since you are headed the USB way, sometime back I did a 1-Wire to USB converter based on a Freescale HC08JB8, its a USB 1.1 chip. I'll try to consolidate all the file and uplaod it over the weekend.

Cheers
Jay
By hcker2000
#6558
jayjay wrote:Since you are headed the USB way, sometime back I did a 1-Wire to USB converter based on a Freescale HC08JB8, its a USB 1.1 chip. I'll try to consolidate all the file and uplaod it over the weekend.

Cheers
Jay
Thanks man that would be a great help. Are all the parts you used prity easy to work with? Basicly I'm trying to keep it as simple as posible and make sure I can suport like 30 temp sensors (I dont plan on using that many but I feel that is a good number to be able to handle).
By hcker2000
#6604
I was wondering if any one had some more info on what I need to do to get the temps and send them to the pc?
By k6rfm
#6705
I have some PIC asm code that reads the temperature from two DS1820s; the DS1820s are on separate i/o ports. If you want to have multiple DS1820s on a single port (and if you want 10 to 30 ds1820s you're going to have to do that!) then you need to read the ROM address codes out of the chips (I do that) and use the address rom command before converting the temp; since I only have one ds1820 per port I just do "skip rom". Note you will want the DS1820 spec sheet and app note 2420 from the Dallas/Maxim website.

I just put my code up at

http://www.pensfa.org/FirstDS1820.asm
By jayjay
#6713
Sorry guys, had to leave town and was not able to post the 1-Wire code as promised. Now I have got the files ready, anyone got a webspace to host it? Its less than 500KB

Cheers
Jay
By hcker2000
#6721
JayJay I can host it. Just email to me hcker2000@gmail.com and I'll post the url for it here.
By jayjay
#6724
Thanks for taking the effort the host the file. I have email 2 zips to you.

Dallas1_Wire_ For_MSP430.zip - 1-Wire low level driver for MSP430, using timer based delay, includes schematic
Dallas1_Wire_ For_HC08JB8.zip - 1-Wire low level driver for HC08JB8, using dead loop delay, the MCU is clocked by a 6Mhz crystal.

Regds
Jay
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]