| | |
| | | 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, |
| | | 0x40 |
| | | }; |
| | | |
| | | /* |
| | | uint16_t crc16table(const uint8_t *ptr, uint16_t len) |
| | | { |
| | | uint8_t crchi = 0xff; |
| | |
| | | } |
| | | return (crchi << 8 | crclo); |
| | | } |
| | | */ |
| | | const uint16_t crctalbeabs[] = { |
| | | 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, |
| | | 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400 |
| | | }; |
| | | |
| | | uint16_t crc16tablefast(const uint8_t *ptr, uint16_t len) |
| | | { |
| | | uint16_t crc = 0xffff; |
| | | uint16_t i; |
| | | uint8_t ch; |
| | | |
| | | for (i = 0; i < len; i++) { |
| | | ch = *ptr++; |
| | | crc = crctalbeabs[(ch ^ crc) & 15] ^ (crc >> 4); |
| | | crc = crctalbeabs[((ch >> 4) ^ crc) & 15] ^ (crc >> 4); |
| | | } |
| | | |
| | | return crc; |
| | | } |
| | | |
| | | /* |
| | | void modbuscrc16test() |
| | | { |
| | |
| | | // SCB->ICSR=SCB_ICSR_PENDSVSET_Msk; //1<<SCB_ICSR_PENDSVSET_Pos; |
| | | // KLParsePacket(Uart1RecvBuf1,Uart1RecvBuf1DataLen); |
| | | // Uart1RecvBuf1DataLen=0; |
| | | TriggerPendSV(); |
| | | } |
| | | } |
| | | |