[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [patch #3925] Dallas iButton 8-bit CRC
From: |
anonymous |
Subject: |
[avr-libc-dev] [patch #3925] Dallas iButton 8-bit CRC |
Date: |
Wed, 20 Apr 2005 21:32:23 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1 |
URL:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=3925>
Summary: Dallas iButton 8-bit CRC
Project: AVR C Runtime Library
Submitted by: None
Submitted on: Wed 04/20/05 at 21:32
Category: None
Priority: 2
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
_______________________________________________________
Details:
I couldn't find this when I went looking for it. So I modified the example in
the crc_xmodem_update function, to come up with the following code. This saved
me 252 bytes vs. a lookup table. I don't know if this CRC is too specific to
this application to be included in this project or not, but here it is
anyways. Maybe it will help someone.
uint8_t crc_ibutton_update (uint8_t crc, uint8_t data)
{
char i;
crc = crc ^ data;
for (i=0; i<8; i++)
{
if (crc & 0x01)
crc = (crc >> 1) ^ 0x8C;
else
crc >>= 1;
}
return crc;
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=3925>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] [patch #3925] Dallas iButton 8-bit CRC,
anonymous <=