0 Members and 1 Guest are viewing this topic.
but I'm outputting verbatim the data part of the packets produced by the calculator (or so I think, at least ).
unsigned short crc = 0;while (len--){ crc = crc16_tab[(crc >> 8) ^ *buffer++] ^ (crc << 8);}
// CCITT CRC-16 look-up table (X^16+X^12+X^5+1)(this looks like a good place to look at: http://www.embeddedrelated.com/groups/msp430/show/29689.php)Initialized the crc bytes to 0 at start (yeah - dumb, caught too late to mess with). Also, looks like it might be including the first byte, but using the "length" value which does not include the first 6. (so first 6 bytes are included and last 6 are not).
static void crc16_block(const uint8_t * buffer, uint32_t len){uint16_t crc = 0;while (len--){ crc = ccitt_crc16_table[(crc >> 8) ^ *buffer++] ^ (crc << 8);}printf("crc16 is %" PRIX16 "\n", crc);}
crc16_block(array2+1, 0x10);crc16_block(array3+1, 0x10);crc16_block(array4+1, 0x10);
crc16 is 9D57crc16 is 68Bcrc16 is 703F
As for the "8 minutes to enumerate", I've never been able to see anything like this. An empty calculator usually takes a few seconds - even over wireless which is slower. How much stuff is in your system? How long does it take an empty calc?