Thread: Crc16

  1. #1
    Registered User
    Join Date
    Aug 2006



    So, I'm chest deep in this project, and I've gotten into a bit of trouble.

    The project is basically a small network operating system that will manage the communcations between a bunch of network nodes (AVR microcontrollers) and a computer. I am wanting to use CRC 16 to do the error checkingon the data transmitions.

    I have found that not all crc libraries are the same... infact, i have yet to find any two that consitantly give the same result... and this is problematic. Because I need to get the same algorythmic results on both devices, I have decided that it would be ideal just to run the same code on both devices.... but... !

    The various pieces of normal c code that I've found work fine on the computer, but they all want to geneate a lookup table which is 512 bytes!!!! And that is exactly 100% of the ram that I've got available on one of my microcontrollers... ain't gonna work.

    Their is one piece of code that I've found that doesn't need a lookup table. It comes with the avr-libc libraries and is called avr/crc16.h. It works great on the microcontrolers, but I can't seem to figure out how to get it to run on my unix box (mac osx command line... aka BSD). That code is here...

    It looks to me like assembler code, and I don't really know how to integrate that in. If I go and just straight compile it, gcc barfs on the the "asm" line... which I'm not sure how to replace.

    Any suggestions would be greatly apprecieated.



  2. #2
    Registered User
    Join Date
    Sep 2006
    That is assembly code.

    This link has a non-table 16 bit crc program in C, as well as a LOT of other, sometimes humorous, info on the strange world of CRC. It also has a table implementation.


  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    Okay so you have 512 bytes of RAM, but how much ROM do you have?
    You may be able to hard-code the table and place it in ROM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question on create a crc16 table
    By mycount in forum Tech Board
    Replies: 3
    Last Post: 08-29-2006, 08:03 PM