PDA

View Full Version : 1-wire emulator



johnyman34
- 15th February 2006, 20:16
I want to emulate a 1-wire device with a Pic!
Any ideia to start?

regards

Joao

DynamoBen
- 16th February 2006, 16:35
That’s pretty easy. OWIN and OWOUT are going to be the commands you use. As far as the protocol I would start with looking through datasheets on the maxim site. The protocol is generally very simple. The only problem you may have is you need a unique ID number if there are going to be other nodes on the line and you will have to create a CRC for each packet. It’s a Master/Slave arrangement so you will need a master to control these slaves you are creating.

This may be a good place to start:

http://www.maxim-ic.com/appnotes.cfm/appnote_number/126

johnyman34
- 17th February 2006, 21:30
Hi DyamoBen
First of all tank you for your kindly reply.

Do you think i can start with something like this?


loop:
owin 2,1,[value]
if value <>0 then continue
goto loop

continue:


tks in advance

DynamoBen
- 17th February 2006, 21:37
Its hard to say for sure if this will work for your application. That being said the command you have will listen to the one-wire line and recieve one byte of data.

You may want to make sure you are specifing the pin the one wire is connected to.

OWIN Pin, Mode,[ Item... ]

IE: owin PortB.2,1,[value]

Darrel Taylor
- 17th February 2006, 23:22
I hate to be the little Smurf that always runs around saying "It'll never work!", but...

It'll never work!

1-wire devices have a Master/Slave type arrangement. OWIN and OWOUT are both Master commands. OWIN will receive from a slave, but will not receive from another master.

If you want to create a slave device, you'll need to write your own routines, which will not be very easy because the timing requirements for 1-wire devices are very strict.

If you decide to write your own. Here's everything you need to know about 1-wire.
http://www.maxim-ic.com/appnotes10.cfm/ac_pk/1
<br>

DynamoBen
- 17th February 2006, 23:38
boo-hiss

I guess it can't be done.

johnyman34
- 18th February 2006, 16:17
I used lots of times Owin and Owout to comunicate with ds2430 without any problems.

Until now i loose hundreds of hours in this project to emulate Ds2430, using Owin an Owout but without any result.

Ideias are welcome!

sougata
- 22nd February 2006, 04:52
Hi,

I couldn't resist myself asking this question. As Darrel said its not going to be easy but it is not impossible. Since you have spend quite an amount of time on the project, knowing a little more about it may trigger other's ideas.


Regards

Sougata

modifyit
- 7th March 2006, 03:24
This is a little off topic, but can you use one-wire devices on any digital pin of a pic-micro...a 16F877a for example?

Thanks

sougata
- 7th March 2006, 05:28
Hi,

I have never used one wire with a PIC but the manual says that it can handle onewire on any port pin. So modifyit the answer to your question is yes.

Regards

Sougata

modifyit
- 9th March 2006, 18:09
That's great news, I just got a one-wire device in the mail that I will try out tonight.

J. Mark Wolf
- 10th March 2006, 12:17
This is a little off topic, but can you use one-wire devices on any digital pin of a pic-micro...a 16F877a for example?

Thanks

Yes, any GPIO pin on a PIC should work just fine for comm with 1-wire devices.

I've been using the smart thermometer parts for years on PIC's without a hitch.