Crc16

This is a discussion on Crc16 within the C Programming forums, part of the General Programming Boards category; Hey! So, I'm chest deep in this project, and I've gotten into a bit of trouble. The project is basically ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    11

    Crc16

    Hey!

    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...

    http://www.propox.com/download/edune...8h-source.html

    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.

    Thanks,

    Bill

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    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.

    http://www.ross.net/crc/download/crc_v3.txt

    Adak

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,305
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21