#ifndef _MODBUS_H #define _MODBUS_H #include #define uint8_t unsigned char #define uint16_t unsigned short #define uint32 unsigned int #define setBit(Add) gBitVar[(Add) >> 3] |= (1 << ((Add)&0x07)) #define clrBit(Add) gBitVar[(Add) >> 3] &= ~(1 << ((Add)&0x07)) #define gBIT_SIZE 128 #define gWORD_SIZE 12288 extern uint8_t gBitVar[(gBIT_SIZE + 7) / 8]; extern uint16_t gWordVar[gWORD_SIZE]; extern uint16_t crc16(uint8_t *puchMsg, uint16_t usDataLen); int isBitHI(uint16_t Add); extern int ModbusSlaveProcess(uint8_t *txbuf, uint8_t *rxbuf, uint16_t rxLen, int is_crc); #endif