55# Using HAL_MODULE_NAME=mb2hal or nothing (default): loadusr -W mb2hal config=config_file.ini
66# Using HAL_MODULE_NAME=mymodule: loadusr -Wn mymodule mb2hal config=config_file.ini
77
8- # Common section
8+ # ++++++++++++++++++++++++
9+ # Common section
10+ # ++++++++++++++++++++++++
911[MB2HAL_INIT]
1012
1113# OPTIONAL: Debug level of init and INI file parsing.
1214# 0 = silent.
1315# 1 = error messages (default).
1416# 2 = OK confirmation messages.
1517# 3 = debugging messages.
18+ # 4 = maximum debugging messages (only in transactions).
1619INIT_DEBUG =3
1720
1821# OPTIONAL: HAL module (component) name. Defaults to "mb2hal".
@@ -26,8 +29,11 @@ HAL_MODULE_NAME=mb2hal
2629SLOWDOWN =0.0
2730
2831# REQUIRED: The number of total Modbus transactions. There is no maximum.
29- TOTAL_TRANSACTIONS =9
32+ TOTAL_TRANSACTIONS =7
3033
34+ # ++++++++++++++++++++++++
35+ # Transactions
36+ # ++++++++++++++++++++++++
3137# One transaction section is required per transaction, starting at 00 and counting up sequentially.
3238# If there is a new link (not transaction), you must provide the REQUIRED parameters 1st time.
3339# Warning: Any OPTIONAL parameter not specified are copied from the previous transaction.
@@ -84,10 +90,10 @@ MB_SLAVE_ID=1
8490# REQUIRED: The first element address.
8591FIRST_ELEMENT =0
8692
87- # REQUIRED unless PINN_NAMES is specified: The number of elements.
93+ # REQUIRED unless PIN_NAMES is specified: The number of elements.
8894# It is an error to specify both NELEMENTS and PIN_NAMES
8995# The pin names will be sequential numbers e.g mb2hal.plcin.01
90- NELEMENTS =16
96+ # NELEMENTS=4
9197
9298# REQUIRED unless NELEMENTS is specified: A list of element names.
9399# these names will be used for the pin names, e.g mb2hal.plcin.cycle_start
@@ -101,20 +107,25 @@ PIN_NAMES=cycle_start,stop,feed_hold
101107# fnct_06_write_single_register (06 = 0x06)
102108# fnct_15_write_multiple_coils (15 = 0x0F)
103109# fnct_16_write_multiple_registers (16 = 0x10)
104-
105- # fnct_02_read_discrete_inputs: creates boolean output HAL pins.
106- # fnct_03_read_holding_registers: creates a floating point output HAL pins.
107- # also creates a u32 output HAL pins.
108- # fnct_04_read_input_registers: creates a floating point output HAL pins.
109- # also creates a u32 output HAL pins.
110- # fnct_06_write_single_register: creates a floating point input HAL pin.
111- # NELEMENTS needs to be 1 or PIN_NAMES must contain just one name
112- # fnct_15_write_multiple_coils: creates boolean input HAL pins.
113- # fnct_16_write_multiple_registers: creates a floating point input HAL pins.
114-
115- # The pins are named based on component name, transaction number and order number.
116- # Example: mb2hal.00.01 (transaction=00, second register=01 (00 is the first one))
117-
110+ #
111+ # Created pins:
112+ # fnct_02_read_discrete_inputs:
113+ # mb2hal.m.n (bit out)
114+ # fnct_03_read_holding_registers:
115+ # fnct_04_read_input_registers:
116+ # mb2hal.m.n.float (float out)
117+ # mb2hal.m.n.int (s32 out)
118+ # fnct_06_write_single_register:
119+ # mb2hal.m.n (float in)
120+ # NELEMENTS needs to be 1 or PIN_NAMES must contain just one name.
121+ # fnct_15_write_multiple_coils:
122+ # mb2hal.m.n (bit in)
123+ # fnct_16_write_multiple_registers:
124+ # mb2hal.m.n (float in)
125+ #
126+ # m = HAL_TX_NAME or transaction number if not set, n = element number (NELEMENTS) or name from PIN_NAMES
127+ # Example: mb2hal.00.01.<type> (transaction=00, second register=01 (00 is the first one))
128+ # mb2hal.TxName.01.<type> (HAL_TX_NAME=TxName, second register=01 (00 is the first one))
118129MB_TX_CODE =fnct_03_read_holding_registers
119130
120131# OPTIONAL: Response timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
@@ -127,9 +138,9 @@ MB_BYTE_TIMEOUT_MS=500
127138
128139# OPTIONAL: Instead of giving the transaction number, use a name.
129140# Example: mb2hal.00.01 could become mb2hal.plcin.01
130- # The name must not exceed 32 characters.
141+ # The name must not exceed 28 characters.
131142# NOTE: when using names be careful that you dont end up with two transactions
132- # usign the same name.
143+ # using the same name.
133144HAL_TX_NAME =remoteIOcfg
134145
135146# OPTIONAL: Maximum update rate in HZ. Defaults to 0.0 (0.0 = as soon as available = infinit).
@@ -147,7 +158,7 @@ DEBUG=1
147158# ILLEGAL_FUNCTION -0x01 the FUNCTION code received in the query is not allowed or invalid.
148159# ILLEGAL_DATA_ADDRESS -0x02 the DATA ADDRESS received in the query is not an allowable address for the slave or is invalid.
149160# ILLEGAL_DATA_VALUE -0x03 a VALUE contained in the data query field is not an allowable value or is invalid.
150- # SLAVE_DEVICE_FAILURE -0x04 SLAVE (or MASTER) device unrecoverable FAILUER while attemping to perform the requested action.
161+ # SLAVE_DEVICE_FAILURE -0x04 SLAVE (or MASTER) device unrecoverable FAILURE while attempting to perform the requested action.
151162# SERVER_FAILURE -0x04 (see above).
152163# ACKNOWLEDGE -0x05 This response is returned to PREVENT A TIMEOUT in the master.
153164# A long duration of time is required to process the request in the slave.
@@ -167,16 +178,15 @@ DEBUG=1
167178
168179[TRANSACTION_01]
169180MB_TX_CODE =fnct_02_read_discrete_inputs
170- FIRST_ELEMENT =1024
171- NELEMENTS =24
172- HAL_TX_NAME =remoteIOin
181+ FIRST_ELEMENT =1280
182+ NELEMENTS =8
183+ HAL_TX_NAME =readStatus
173184MAX_UPDATE_RATE =0.0
174- DEBUG =1
175185
176186[TRANSACTION_02]
177187MB_TX_CODE =fnct_15_write_multiple_coils
178- FIRST_ELEMENT =1280
179- NELEMENTS =8
188+ FIRST_ELEMENT =150
189+ NELEMENTS =10
180190HAL_TX_NAME =remoteIOout
181191MAX_UPDATE_RATE =0.0
182192
@@ -197,37 +207,25 @@ MAX_UPDATE_RATE=0.0
197207DEBUG =1
198208
199209[TRANSACTION_04]
200- MB_TX_CODE =fnct_03_read_holding_registers
201- FIRST_ELEMENT =4
210+ MB_TX_CODE =fnct_04_read_input_registers
211+ FIRST_ELEMENT =12
202212NELEMENTS =3
203213HAL_TX_NAME =XDrive02
204- MAX_UPDATE_RATE =0 .0
214+ MAX_UPDATE_RATE =10 .0
205215DEBUG =1
206216
207217[TRANSACTION_05]
208- MB_TX_CODE =fnct_03_read_holding_registers
209- FIRST_ELEMENT =9
218+ MB_TX_CODE =fnct_06_write_single_register
219+ FIRST_ELEMENT =20
210220NELEMENTS =1
211221HAL_TX_NAME =XDrive03
212222MAX_UPDATE_RATE =0.0
223+ DEBUG =1
213224
214225[TRANSACTION_06]
215- MB_TX_CODE =fnct_03_read_holding_registers
216- FIRST_ELEMENT =1024
217- NELEMENTS =1
226+ MB_TX_CODE =fnct_16_write_multiple_registers
227+ FIRST_ELEMENT =55
228+ NELEMENTS =8
218229HAL_TX_NAME =XDrive04
219- MAX_UPDATE_RATE =0.0
220-
221- [TRANSACTION_07]
222- MB_TX_CODE =fnct_03_read_holding_registers
223- FIRST_ELEMENT =1030
224- NELEMENTS =2
225- HAL_TX_NAME =XDrive05
226- MAX_UPDATE_RATE =0.0
227-
228- [TRANSACTION_08]
229- MB_TX_CODE =fnct_03_read_holding_registers
230- FIRST_ELEMENT =1033
231- NELEMENTS =1
232- HAL_TX_NAME =XDrive06
233- MAX_UPDATE_RATE =0.0
230+ MAX_UPDATE_RATE =10.0
231+ DEBUG =1
0 commit comments