Espressif ESP32-S2 Programming Manual page 636

Table of Contents

Advertisement

Chapter 2. API Reference
Note: The cid and param_key have to be unique. Please use the prefix to the parameter key if you have several
similar parameters in your register map table.
Table 8: Table 2 Example Register mapping table of Modbus slave
CID Register
Length
Range
0
30000 4 MAX_UINT U 32 Not
1
30002 2 MAX_UINT U 16 Not
2
40000 4 -20..40
// Enumeration of modbus slave addresses accessed by master device
enum
{
MB_DEVICE_ADDR1
MB_DEVICE_ADDR2,
MB_SLAVE_COUNT
};
// Enumeration of all supported CIDs for device
enum
{
CID_SER_NUM1
=
0,
CID_SW_VER1,
CID_TEMP_DATA_1,
CID_SER_NUM2,
CID_SW_VER2,
CID_TEMP_DATA_2
};
// Example Data Dictionary for Modbus parameters in 2 slaves in the segment
mb_parameter_descriptor_t device_parameters[]
// CID, Name, Units, Modbus addr, register type, Modbus Reg Start Addr,
Reg read length,
// Instance offset (NA), Instance type, Instance length (bytes), Options
Permissions
{ CID_SER_NUM1, STR("Serial_number_1"), STR("--"), MB_DEVICE_ADDR1, MB_PARAM_
INPUT, 0, 2,
TRIGGER },
{ CID_SW_VER1, STR("Software_version_1"), STR("--"), MB_DEVICE_ADDR1, MB_PARAM_
INPUT, 2, 1,
TRIGGER },
{ CID_TEMP_DATA_1, STR("Temperature_1"), STR("C"), MB_DEVICE_ADDR1, MB_PARAM_
HOLDING, 0, 2,
WRITE_TRIGGER },
{ CID_SER_NUM2, STR("Serial_number_2"), STR("--"), MB_DEVICE_ADDR2, MB_PARAM_
INPUT, 0, 2,
TRIGGER },
{ CID_SW_VER2, STR("Software_version_2"), STR("--"), MB_DEVICE_ADDR2, MB_PARAM_
INPUT, 2, 1,
TRIGGER },
{ CID_TEMP_DATA_2, STR("Temperature_2"), STR("C"), MB_DEVICE_ADDR2, MB_PARAM_
HOLDING, 0, 2,
Espressif Systems
TypeUnitsDescription
Serial number of device (4 bytes) read-only
de-
fined
Software version (4 bytes) read-only
de-
fined
FLOAT DegCRoom temperature in DegC. Writing a temperature value to this register for
single point calibration.
=
1,
0, PARAM_TYPE_U32, 4, OPTS(
0, PARAM_TYPE_U16, 2, OPTS(
0, PARAM_TYPE_FLOAT, 4, OPTS( 16, 30,
0, PARAM_TYPE_U32, 4, OPTS(
0, PARAM_TYPE_U16, 2, OPTS(
Submit Document Feedback
=
{
0,0,0
), PAR_PERMS_READ_WRITE_
0,0,0
), PAR_PERMS_READ_WRITE_
1
0,0,0
), PAR_PERMS_READ_WRITE_
0,0,0
), PAR_PERMS_READ_WRITE_
625
Modbus␣
(NA),␣
), PAR_PERMS_READ_
(continues on next page)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF