2024-01-20 17:56:00 +08:00
|
|
|
#ifndef _MODBUS_H
|
|
|
|
#define _MODBUS_H
|
|
|
|
#include <stdint.h>
|
2024-01-22 03:36:10 +08:00
|
|
|
|
2024-01-20 17:56:00 +08:00
|
|
|
#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
|
2024-01-22 03:36:10 +08:00
|
|
|
|
2024-01-20 17:56:00 +08:00
|
|
|
extern uint8_t gBitVar[(gBIT_SIZE + 7) / 8];
|
|
|
|
extern uint16_t gWordVar[gWORD_SIZE];
|
|
|
|
|
2024-01-22 03:36:10 +08:00
|
|
|
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);
|
2024-01-20 17:56:00 +08:00
|
|
|
|
|
|
|
#endif
|