I've done quite a bit of searching for CRC algorithms using
polynomial 0x1021 and testing them.  Without even looking at your
code, let me tell what I've found.

Only one algorithm of the four I found returns the "correct" value
of 0xE5CC on the 9-character test string when initialized to
0xFFFF.  The other three return 0x29B1.

All four algorithms return 0x31C3 when initialized with 0x0000.

All four algorithms return 0x0000 when the CRC is included as the
last two bytes (big endian), regardless of initialization.  
(So they all "work".)

The fastest algorthm was nearly 6 times as fast as the slowest.
The slowest was the one that returned the "correct" result.  
The fastest was implemented in PIC code here:
<http://www.dattalo.com/technical/software/pic/crc_1021.asm>

-Ken Jackson


Greg Mann writes:
 > I am beyond myself tring to find the problem with the attached
 > code.  It is giving me a error on a ";".  I have been able to
 > get this code to run on other demo compiler.  If anyone could
 > find the problem it would make me very happy.
 >    
 >   Greg Mann
 >    
 > ...
 >
 > /* 
 > demonstrates how the incorrect check value of 0x29B1 may be reported 
 > for the test string "123456789" when it should be 0xE5CC. 
 > */ 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to