Very nice and short. It looks like you can recursively call it to build your crc for the entire message+header.
// Calculate the CRC for the header and message. crc = sysCRC16(TNC_AX25_HEADER, sizeof(TNC_AX25_HEADER), 0xffff); crc = sysCRC16(tncBuffer, tncLength, crc ^ 0xffff); // Save the CRC in the message. *tncBufferPnt++ = crc & 0xff; *tncBufferPnt = (crc >> 8) & 0xff; Could you recursively call it as you aquire the data and build up your message? Original Message: ----------------- From: [EMAIL PROTECTED] Date: Mon, 5 Dec 2005 09:42:40 -0700 (MST) To: [EMAIL PROTECTED], discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] gmsk error 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, [EMAIL PROTECTED] 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 > Discuss-gnuradio@gnu.org > http://lists.gnu.org/mailman/listinfo/discuss-gnuradio > -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio