Skip to content

Commit

Permalink
Merge pull request #2 from nykytenko/tmp/dev.t1
Browse files Browse the repository at this point in the history
Tmp/dev.t1
  • Loading branch information
nykytenko authored Nov 17, 2023
2 parents 290ce30 + 15ba0a5 commit 684b4bc
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 22 deletions.
4 changes: 3 additions & 1 deletion Cfg/Template/mb_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@
#define MODBUS_CFG_FC15_EN DEF_ENABLED
#define MODBUS_CFG_FC16_EN DEF_ENABLED
#define MODBUS_CFG_FC20_EN DEF_DISABLED
#define MODBUS_CFG_FC21_EN DEF_DISABLED
#define MODBUS_CFG_FC21_EN DEF_DISABLED
#define MODBUS_CFG_FC43_EN DEF_DISABLED
#define MODBUS_CFG_FC43_14_EN DEF_DISABLED
16 changes: 16 additions & 0 deletions Source/mb.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,15 @@ void MB_FileWr (CPU_INT16U file_nbr,
CPU_INT16U *perr);
#endif

#if (MODBUS_CFG_FC43_EN == DEF_ENABLED)
#if (MODBUS_CFG_FC43_14_EN == DEF_ENABLED)
CPU_INT08U MB_DeviceIdRd (CPU_INT08U device_id_code,
CPU_INT08U object_id,
CPU_CHAR const **object_value,
CPU_INT16U *perr);
#endif
#endif

/*
*********************************************************************************************************
* BSP FUNCTION PROTOTYPES
Expand Down Expand Up @@ -688,6 +697,13 @@ CPU_INT16U MBM_FC16_HoldingRegWrNFP (MODBUS_CH *pch,
#error "MODBUS_CFG_FC21_EN not #defined "
#endif

#ifndef MODBUS_CFG_FC43_EN
#error "MODBUS_CFG_FC43_EN not #defined "
#endif

#ifndef MODBUS_CFG_FC43_14_EN
#error "MODBUS_CFG_FC43_14_EN not #defined "
#endif


/*
Expand Down
25 changes: 21 additions & 4 deletions Source/mb_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#define MODBUS_FC16_HOLDING_REG_WR_MULTIPLE 16 /* Holding registers */
#define MODBUS_FC20_FILE_RD 20 /* Read contents of a File/Record */
#define MODBUS_FC21_FILE_WR 21 /* Write data to a File/Record */
#define MODBUS_FC43_ENC_INTERFACE_TRANSPORT 43 /* Encapsulated Interface Transport */

#define MODBUS_FC08_LOOPBACK_QUERY 0 /* Loopback sub-function codes */
#define MODBUS_FC08_LOOPBACK_CLR_CTR 10
Expand All @@ -83,6 +84,8 @@
#define MODBUS_FC08_LOOPBACK_SLAVE_MSG_CTR 14
#define MODBUS_FC08_LOOPBACK_SLAVE_NO_RESP_CTR 15

#define MODBUS_FC43_MEI_DEVID_RD 14


#define MODBUS_COIL_OFF_CODE 0x0000
#define MODBUS_COIL_ON_CODE 0xFF00
Expand All @@ -94,10 +97,15 @@

#define MODBUS_ERR_NONE 0

#define MODBUS_ERR_ILLEGAL_FC 1
#define MODBUS_ERR_ILLEGAL_DATA_ADDR 2
#define MODBUS_ERR_ILLEGAL_DATA_QTY 3
#define MODBUS_ERR_ILLEGAL_DATA_VAL 4
#define MODBUS_ERR_ILLEGAL_FC 0x01
#define MODBUS_ERR_ILLEGAL_DATA_ADDR 0x02
#define MODBUS_ERR_ILLEGAL_DATA_VAL 0x03
#define MODBUS_ERR_SERVER_DEVICE_FAILURE 0x04
#define MODBUS_ERR_ACKNOWLEDGE 0x05
#define MODBUS_ERR_SERVER_DEVICE_BUSY 0x06
#define MODBUS_ERR_MEMORY_PARITY_ERROR 0x08
#define MODBUS_ERR_GW_PATH_UNAVAILABLE 0x0A
#define MODBUS_ERR_GW_TARGDEV_FAILED_TO_RES 0x0B

#define MODBUS_ERR_FC01_01 101
#define MODBUS_ERR_FC01_02 102
Expand Down Expand Up @@ -126,6 +134,7 @@
#define MODBUS_ERR_FC15_01 1501
#define MODBUS_ERR_FC15_02 1502
#define MODBUS_ERR_FC15_03 1503
#define MODBUS_ERR_FC15_04 1504

#define MODBUS_ERR_FC16_01 1601
#define MODBUS_ERR_FC16_02 1602
Expand All @@ -145,6 +154,14 @@
#define MODBUS_ERR_FC21_04 2104
#define MODBUS_ERR_FC21_05 2105

#define MODBUS_ERR_FC43_01 4301

#define MODBUS_ERR_FC43_14_01 4311
#define MODBUS_ERR_FC43_14_02 4312
#define MODBUS_ERR_FC43_14_03 4313
#define MODBUS_ERR_FC43_14_04 4314
#define MODBUS_ERR_FC43_14_05 4315

#define MODBUS_ERR_TIMED_OUT 3000
#define MODBUS_ERR_NOT_MASTER 3001
#define MODBUS_ERR_INVALID 3002
Expand Down
Loading

0 comments on commit 684b4bc

Please sign in to comment.