| | |
| | | |
| | | void logData(unsigned char d) |
| | | { |
| | | KMem.WDB[128+KMem.WDT[123]] = d; |
| | | KMem.WDT[123]++; if (KMem.WDT[123]>=100) {KMem.WDT[123]=81;} |
| | | KMem.WDB[128+KMem.WDT[7]] = d; |
| | | KMem.WDT[7]++; if (KMem.WDT[7]>=100) {KMem.WDT[7]=81;} |
| | | } |
| | | |
| | | /* |
| | | const unsigned short crc16_table[256] = { |
| | | 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, |
| | | 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, |
| | |
| | | } |
| | | return(crc); |
| | | } |
| | | |
| | | */ |
| | | /* Table of CRC values for high-order byte */ |
| | | const uint8_t crctablehi[] = { |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, |
| | |
| | | } |
| | | return (crchi << 8 | crclo); |
| | | } |
| | | |
| | | /* |
| | | void modbuscrc16test() |
| | | { |
| | | printf("\n"); |
| | |
| | | // printf(" modbus crc16tablefast test, expected value : 0xd825, calculate value : 0x%x\n", crc16tablefast(crc16_data, sizeof(crc16_data))); |
| | | printf(" modbus crc16bitbybit test, expected value : 0xd825, calculate value : 0x%x\n", crc16bitbybit(crc16_data, sizeof(crc16_data))); |
| | | } |
| | | |
| | | */ |
| | | int InitUartstat(stUartStat * pUartstat,void * pBufRx, int nSizeRx, void * pBufTx, int nSizeTx) |
| | | { |
| | | memset(pUartstat,sizeof(stUartStat),0); |
| | | initQueue(&pUartstat->QRx,pBufRx,nSizeRx); |
| | | initQueue(&pUartstat->QTx,pBufTx,nSizeTx); |
| | | if (pBufRx) initQueue(&pUartstat->QRx,pBufRx,nSizeRx); |
| | | if (pBufTx) initQueue(&pUartstat->QTx,pBufTx,nSizeTx); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | logData(value); |
| | | } |
| | | } |
| | | #else |
| | | UNUSED(value); |
| | | #endif |
| | | } |
| | | } |
| | |
| | | #else |
| | | Uart2UnsetDE(); |
| | | #endif |
| | | Uart2Stat.bSendDone = 1; |
| | | TriggerPendSV(); |
| | | } |
| | | void Uart2RecvDone() |
| | | { |