discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gmsk error


From: mgray
Subject: Re: [Discuss-gnuradio] gmsk error
Date: Mon, 5 Dec 2005 09:42:40 -0700 (MST)

This is the whole thing.  You don't need a lookup table.

/**
 *    Calculate the CRC-16 CCITT of <b>buffer</b> that is <b>length</b> 
bytes long.
 *    The <b>crc</b> parameter allow the calculation on the CRC on 
multiple buffers.
 *
 *    @param buffer Pointer to data buffer.
 *    @param length number of bytes in data buffer
 *    @param crc starting value
 *
 *    @return CRC-16 of buffer[0 .. length]
 */
uint16_t sysCRC16(uint8_t *buffer, uint8_t length, uint16_t crc)
{
    uint8_t i, bit, value;

    for (i = 0; i < length; ++i) 
    {
        value = buffer[i];

        for (bit = 0; bit < 8; ++bit) 
        {
            crc ^= (value & 0x01);
            crc = ( crc & 0x01 ) ? ( crc >> 1 ) ^ 0x8408 : ( crc >> 1 );
            value = value >> 1;
        } // END for
    } // END for

    return crc ^ 0xffff;
}


On Mon, 5 Dec 2005, address@hidden wrote:

> On Thu, 1 Dec 2005 16:02:59 -0700 (MST), mgray wrote:
> > The following is a link to CRC16 for the PIC controller with similiar
> > memory limitations:
> 
> > http://www.kd7lmo.net/picobeacon_code.html
> 
> I looked at the code and all I could find was the function sysCRC16 in
> lines 1899-1916 of the PicoBeacon.c.
> 
> I could not find a lookup table.  Is there any look up table or is it just
> the codes in the lines I mentioned?
> 
> Mike
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
> 
> 
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]