1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef __NODE_MESSAGE_H
- #define __NODE_MESSAGE_H
- #include "stm32f2xx.h"
- #define slave
- #ifdef slave
- // 存储在本地的枚举了协议类型
- #define MODBUS_WRITE 4 //本机用于区分读写
- #define MODBUS_READ 3
- #define DLT645_07 2
- #define DLT645_97 1
- typedef struct _NODE_DLT645_PARAMS
- {
- uint32_t dataType645; //645数据标识
- uint8_t deviceType645[6]; //645地址
- uint8_t datalength;
- uint8_t value[10];
- uint8_t rxLen;
- }NODE_DLT645_PARAMS;
- typedef struct _NODE_MODBUS_READ
- {
- uint8_t slaveAddress;
- uint8_t functionCode;
- uint16_t registerAddress;
- uint16_t registerLength;
- uint8_t dataType; //数据类型
- uint8_t precision;
- uint8_t bigLittleFormat;
- uint8_t flag; //此属性读取是否成功
- uint8_t callback[4]; //对应读取到的数据存储于此
- uint8_t rxLen;
- }NODE_MODBUS_READ;
- typedef struct _NODE_MODBUS_WRITE
- {
- uint8_t slaveAddress;
- uint8_t functionCode;
- uint8_t dataType; //数据类型
- uint16_t registerAddress;
- uint16_t registerLength;
- uint8_t bigLittleFormat;
- uint8_t flag; //写入指令操作是否成功标志
- }NODE_MODBUS_WRITE;
- typedef struct _PARAMS
- {
- uint8_t protcol; //此属性决定用那个协议属性也会包含对应的响应值,其他未涉及到的属性赋值为NULL
- NODE_DLT645_PARAMS *dlt645_params;
- NODE_MODBUS_READ *modbus_read;
- NODE_MODBUS_WRITE *modbus_write;
- }PARAMS;
- typedef struct _NODE_DEVICE_PARAMS
- {
- uint8_t Index; //记录总共有多少个属性
- PARAMS params[20];
- }NODE_DEVICE_PARAMS;
- NODE_DEVICE_PARAMS *get_node_receive_params();
- void free_all_node_params();
- extern uint8_t protocol_485;
- #endif
- #endif
|