Modbus TCP v1
This commit is contained in:
@@ -7,9 +7,22 @@
|
||||
|
||||
#include "modbus_memory.h"
|
||||
|
||||
#define MODBUS_MAX_POINTS 130
|
||||
#define MODBUS_MAX_NAME_LEN 32
|
||||
#define MODBUS_MAX_NOTES_LEN 64
|
||||
#define MODBUS_MAX_POINTS 80 /* Max point entries per device, including helper registers */
|
||||
/*
|
||||
Modbus Data Type
|
||||
- bool = 1 register
|
||||
- uint16 = 1 register
|
||||
- uint32 = 2 registers
|
||||
- float = 2 registers
|
||||
|
||||
Example: If max is set to 2, you can have this combination:
|
||||
- 2 bool Data_Type
|
||||
- 2 uint16 Data_Type
|
||||
- 1 uint32 Data_Type
|
||||
- 1 float Data_Type
|
||||
|
||||
*/
|
||||
|
||||
#define MODBUS_MAX_CSV_LINE_LEN 256
|
||||
|
||||
typedef enum
|
||||
@@ -24,20 +37,20 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
MB_DATA_BOOL = 0,
|
||||
MB_DATA_UINT16,
|
||||
MB_DATA_UINT32,
|
||||
MB_DATA_FLOAT,
|
||||
MB_DATA_DOUBLE,
|
||||
MB_DATA_UINT16, /* 1 Register*/
|
||||
MB_DATA_UINT32, /* 2 Registers */
|
||||
MB_DATA_FLOAT, /* 2 Registers */
|
||||
MB_DATA_DOUBLE, /* 4 Registers */
|
||||
MB_DATA_INVALID
|
||||
} modbus_data_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PICS_DATA_NONE = 0,
|
||||
PICS_DATA_BOOLEAN,
|
||||
PICS_DATA_INTEGER, /* PICS Integer = 32-bit */
|
||||
PICS_DATA_FLOAT, /* PICS Float = 64-bit double */
|
||||
PICS_DATA_STRING,
|
||||
PICS_DATA_BOOLEAN, /* PICS Boolean = 1 bit ; uses 1 Register */
|
||||
PICS_DATA_INTEGER, /* PICS Integer = 32-bit ; uses 2 Registers*/
|
||||
PICS_DATA_FLOAT, /* PICS Float = 64-bit double ; uses 4 registers */
|
||||
PICS_DATA_STRING, /* This is ignored, just brought in incase users usees it, ESP32 will ignore it*/
|
||||
PICS_DATA_INVALID
|
||||
} pics_data_type_t;
|
||||
|
||||
@@ -47,7 +60,6 @@ typedef struct modbus_point
|
||||
uint32_t raw_address;
|
||||
uint16_t offset;
|
||||
|
||||
char name[MODBUS_MAX_NAME_LEN];
|
||||
modbus_data_type_t data_type;
|
||||
|
||||
uint8_t reg_span;
|
||||
@@ -67,7 +79,6 @@ typedef struct modbus_point
|
||||
|
||||
uint16_t pics_words[4];
|
||||
|
||||
char notes[MODBUS_MAX_NOTES_LEN];
|
||||
|
||||
uint8_t bit_value;
|
||||
uint16_t reg_value;
|
||||
@@ -87,9 +98,6 @@ void modbus_points_reset(modbus_db_t *db);
|
||||
bool modbus_points_load(modbus_db_t *db, const char *filename);
|
||||
|
||||
/* Lookup helpers */
|
||||
const modbus_point_t *modbus_points_find_by_name(const modbus_db_t *db,
|
||||
const char *name);
|
||||
|
||||
const modbus_point_t *modbus_points_find_by_type_offset(const modbus_db_t *db,
|
||||
modbus_point_type_t type,
|
||||
uint16_t offset);
|
||||
|
||||
Reference in New Issue
Block a user