On Mar 14, 11:55 pm, mattschinkel <[email protected]> wrote:
> Thanks Mike, but I wonder if the lookup table should be in ram
> instead. I think ram is much faster, so maybe a constant should be
> made so the user can choose.

it's 256 byte!  not good for some PIC.   How much difference in speed
is there?

I have also a run time table generator in my library. Small code.
It will make a 256byte table in RAM at startup time.

We have one for the RDS 11 bit CRC too.


So you can use RAM or Flash depending on application and PIC. But
Table based is the fast method though not obvious.
worth a read http://www.ross.net/crc/download/crc_v3.txt



-- not tested. Alternative to Table as Const in Flash etc..

-- translated from "c" on http://www.eccpage.com/crc-32b.c
-- CRC_POLY_32 is for pkzip Xmodem etc, other 32bit CRCs may use a
different
--  polynomial
var byte crcTable_32[256]

const dword CRC_POLY_32  = 0xEDB88320

procedure crcgen(dword in poly ) is
var dword       crc
var sword       i, j

        -- should be poly = 0xEDB88320 allegedly
        for 256 using i loop
                crc = dword(i)
                j = 8
                for 8 loop
                        if ((crc & 1) > 0) then
                                crc = (crc >> 1) ^ poly
                        else
                                crc = crc >> 1
                        end if
                        j = j -1
                end loop
                crcTable_32[i] = byte(crc & 0xFF)
        end loop
end procedure

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to