View previous topic :: View next topic |
Author |
Message |
Guest
|
DS2411 1-Wire |
Posted: Wed Mar 23, 2005 7:41 am |
|
|
Hi !
I'd like to use the DS2411 1-Wire for a project.
Could anybody provide me some C code?
Many thanks. |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
|
Guest
|
|
Posted: Tue Mar 29, 2005 9:28 am |
|
|
I found how it works more or less but i just wondered why the CRC does not match with the last 8 bit.
Anyway, i find a serial number with hexadecimal numbers which seems to be correct.
Thanks. |
|
|
Guest
|
|
Posted: Tue Mar 29, 2005 9:30 am |
|
|
ok thanks not that easy :( |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Tue Mar 29, 2005 9:51 am |
|
|
Anonymous wrote: | Anyway, i find a serial number with hexadecimal numbers which seems to be correct. |
when i was starting out with 1wire, i had the same concern -- "how do i know my crc routine is working?"
it was very frustrating since my code for the 1wire device on the prototype board i was using kept returning "0x00" as the crc byte.
i debugged and recompiled my code about 87 times, looking for the error i had obviously made.
finally, i sat down and *BY HAND* calculated the crc for the device bytes.
turns out the crc *was* 0x00. i had a 1/255 chance of getting a part like this, and i did!
jds-pic
ps
if you have the rom space, you can use the lookup table method rather than the computation method. it's the std time-vs-space tradeoff. but quicly implementing the lookup table (even by hand as i did) will allow you to verify that the computational method is indeed correct.
see
http://pdfserv.maxim-ic.com/arpdf/AppNotes/app27.pdf |
|
|
|