26 lines
576 B
C
26 lines
576 B
C
|
#ifndef _MODBUS_H
|
||
|
#define _MODBUS_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include "gwordvar.h"
|
||
|
|
||
|
#define setBit(Add) gBitVar[(Add)>>3] |= (1<<((Add)&0x07))
|
||
|
#define clrBit(Add) gBitVar[(Add)>>3] &= ~(1<<((Add)&0x07))
|
||
|
|
||
|
#define BUFFER_SIZE 2000
|
||
|
#define gBIT_SIZE 128
|
||
|
#define MODBUS_SALVE_ADDRESS 0x01
|
||
|
|
||
|
|
||
|
extern uint8_t gBitVar[(gBIT_SIZE+7)/8];
|
||
|
|
||
|
extern uint8_t rx_buffer[256];
|
||
|
extern uint8_t tx_buffer[256];
|
||
|
extern uint16_t rx_buff_len;
|
||
|
|
||
|
extern int ModbusSlaveProcess(uint8_t *txbuf, uint8_t *rxbuf, uint16_t rxLen, int is_crc);
|
||
|
void ModBusWordWriteHook(uint16_t addr, uint16_t length);
|
||
|
|
||
|
#endif
|
||
|
|