Hi Dave, I've been meaning to get onto this thread for a few days now, but haven't had the time.. sorry about that. Don't you hate it when real work gets in the way :) The code is free for anyone to use, so go ahead, enjoy. I've also been meaning to update the page with all the various optimised versions, so I'll add this to the list as well :) One day I'll get onto it.. I promise ;P > #define TB_FILE "crctable.out" > #define TB_WIDTH 4 > #define TB_POLY 0x04C11DB7L > #define TB_REVER TRUE Scott, I suspect the reason that you couldn't get the polygon working is because it looks like a CRC32 one not a CRC16 one.. The code on the website you mentioned is general enough to generate tables for any width CRC, mine only does CRC16s. --- Ashley Roll Digital Nemesis Pty Ltd www.digitalnemesis.com Mobile: +61 (0)417 705 718 > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Dave Dribin > Sent: Wednesday, 21 August 2002 9:59 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: simulator vs. real CRC results > > > Ok, I finally understand Ashley Roll's CRC code from enough to modify > it: > > http://www.digitalnemesis.com/ash/projects/EmbeddedCRC16/default.htm > > Here is a modified vesion of "piccrc.asm" which I call "piccrcr.asm". > The difference being that the table is using a poly of 8005 and > contains "built-in" reflection, as described here: > > http://www.geocities.com/SiliconValley/Pines/8659/crc.htm#r11 > > Besides the table, the only other code difference is that the CRC is > shifted right 4 bits at a time rather than left. > > Not sure if you can do attachments to this list, so the code is > included at the end of the message. > > I can share my modified version of "gentable.c", too, if others are > curious how a reflected table is generated. > > Ok, so this is nowhere near 17 instructions, but hey, it *works*. :) > Tony, I'm not so sure that the table can be calculated as per your > earlier optimizations. But feel free to look for a pattern. :) > > BTW, I hope this code is in the public domain so that I am free to use > it in my project. > > Oh, and finally, this code works on a real PIC, too, not just the > simulator. Here's the output from the serial port: -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads