1-wire serial number reading-Anyone has experience?
JohnGuy
Posts: 13
I want to read three 1-wire serial number devices (eg. DS2401, or DS2431). Then, depending upon the devices found to be connected, I want to activate a logic line. There are, say, a dozen possible devices that might be connected to the 1-wire bus, and each device would require a different logic line raised. (I can decode this from a BCD output if necessary).
I wonder if folks out there can help me.... I'm an RF/analog engineer, trying to do something digital. (I don't understand assembly language).
Can you help me?
Thanks
JohnGuy
I wonder if folks out there can help me.... I'm an RF/analog engineer, trying to do something digital. (I don't understand assembly language).
Can you help me?
Thanks
JohnGuy
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
If you dont have a bs2P, you can use a bs2sx and a DS2480B serial to 1wire converter.
the datasheet is at···· ·http://datasheets.maxim-ic.com/en/ds/DS2480B.pdf
A BS2 wont·work properly·because the DS2480B requires 9600 bps data speed both ways, and the data will be unreliable going back from the DS2480B to the stamp.
Using a faster BS2SX will ensure that the data is read in correctly (if you use the DS2480B). Using this device is difficult as it is surface mount, and more code intensive than the following...
I use a bs2P24 and OWIN / OWOUT commands, and it is actually a lot simpler and more reliable than using a BS2SX. It also only requires a 4.7K pullup resistor to the i/o pin, and you are away.
Sorry I cant give code, as I have never done it with more than 1 device on the bus and simply reading the id number inside.
You can also do it with an SX chip quite simply now using the SXB compiler, and it is also simple to hook up.
There is a good example in the SX editor help section.
Cheers,
Chris,
West Oz.
Franklin, What is the "IDE" [noparse][[/noparse]"look at the bs reference in the IDE"]?
Chris, I am about to purchase a stamp, so I'll buy the professional development board and the bs2P24, as you suggest.
Thanks for the tip on the "OWIN/OWOUT" commands. Even if your code just looks at the number inside, for one device, it would help me out a lot, just to get me started. I'd love to see it, if that's okay?
Thanks for the help!
JohnGuy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
The second method takes more programming and is a discovery process, where the program itself searches for what serial numbers are present by repeated application of the searchROM routine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Hope this helps...
The following simply reads the first·2 bytes of the ibutton id number into 3 byte size variables. Yo can add more bytes to read more of the ID number
The family variable is the family (or type) of ibutton.
OWPIN is the i/o pin that is connected to the button reader, and also connects to 5v via a 4.7K pullup resistor.
··· family var byte
··· byte1 var byte
··· byte2 var byte
··· start:
··· OWOUT OWpin, %0001, [noparse][[/noparse]$33]
··· OWIN OWPin, %0010, [noparse][[/noparse]family, byte1, byte2]
··· debug CR, "Family ", hex2 family,·TAB, "ID ",·hex2 byte2, hex2 byte1
··· pause 5000
··· goto start
Cheers from West Oz...
I very much appreciate your help. Unfortunately the hardware hasn't arrived yet....
West Oz - this sounds very exotic to a central Canadian.
Thanks again!!
JohnGuy
Remote... but nice. (our capital (Perth) is the most remote capital city in the world).
We hope to be·getting colour television next year... [noparse]:)[/noparse]
Cheers, Chris
Result: It gives me a coil ID of 00 00 00 00 .... 00.
Also I tried the program that Parallax supplies in their downloads. It also gives a coil ID of 00 00 00 00 .... 00. It claims the CRC = 00, and CRC okay.
This is all independent of which bus line I have the device on! If I ask the software to go to bus 14, which is empty, "OWpin CON 14 '1-wire device pin ",
it again tells me thea coil ID is 00 00 00 00 .... 00. Shouldn't it tell me it can't find a device, if this bus line is empty?
Hi Chris - I googlemapped Perth. Are there nice beaches there? Is it more remote than Adelaide of Sydney? By remote, do you mean there are no other cities around it? Is it desert?
Toronto is not remote, but there are times I wish it was. The traffic is horrible, as are the smog and humidity. But there are certainly worse places to live!!
Thanks,
JohnGuy
"and also connects to 5v via a 4.7K pullup resistor".
I added the pullup resistors, and it now works. I'm reading a DS2401 digital serial number.
I want to use a DS2506, so that I can write stuff to is and then read it. But my programmer is broken.
I'll keep trying!!
Thanks,
John