40 lines
988 B
C
40 lines
988 B
C
|
#ifndef _MODBUS_STRUCT_H
|
||
|
#define _MODBUS_STRUCT_H
|
||
|
|
||
|
//#include "RS_Functions.h"
|
||
|
|
||
|
struct MODBUS_WORD_STRUCT { // bit description
|
||
|
unsigned int LB:8; // 16:23 High word low byte
|
||
|
unsigned int HB:8; // 24:31 High word high byte
|
||
|
};
|
||
|
|
||
|
|
||
|
struct MODBUS_BITS_STRUCT { // bit description
|
||
|
unsigned int bit0: 1;
|
||
|
unsigned int bit1: 1;
|
||
|
unsigned int bit2: 1;
|
||
|
unsigned int bit3: 1;
|
||
|
unsigned int bit4: 1;
|
||
|
unsigned int bit5: 1;
|
||
|
unsigned int bit6: 1;
|
||
|
unsigned int bit7: 1;
|
||
|
unsigned int bit8: 1;
|
||
|
unsigned int bit9: 1;
|
||
|
unsigned int bit10: 1;
|
||
|
unsigned int bit11: 1;
|
||
|
unsigned int bit12: 1;
|
||
|
unsigned int bit13: 1;
|
||
|
unsigned int bit14: 1;
|
||
|
unsigned int bit15: 1;
|
||
|
};
|
||
|
|
||
|
typedef union {
|
||
|
//unsigned int all;
|
||
|
int all;
|
||
|
struct MODBUS_BITS_STRUCT bit;
|
||
|
struct MODBUS_WORD_STRUCT byte;
|
||
|
} MODBUS_REG_STRUCT;
|
||
|
|
||
|
#endif
|
||
|
|