#This .INI file is also the HELP, MANUAL and HOW-TO file for mb2hal.

#Load the modbus HAL userspace module as the examples below,
#change to match your own HAL_MODULE_NAME and .ini file name
#Using HAL_MODULE_NAME=mb2hal or nothing (default): loadusr -W mb2hal config=config_file.ini
#Using HAL_MODULE_NAME=mymodule: loadusr -Wn mymodule mb2hal config=config_file.ini

#Common section

[MB2HAL_INIT]

#OPTIONAL: Debug level of init and INI file parsing.
# 0 = silent.
# 1 = error messages (default).
# 2 = OK confirmation messages.
# 3 = debugging messages.

INIT_DEBUG=3

#OPTIONAL: Set to 1.1 to enable the new functions:
# - fnct_01_read_coils
# - fnct_05_write_single_coil
# - changed pin names (see https://linuxcnc.org/docs/2.9/html/drivers/mb2hal.html#_pins).

VERSION=1.1

#OPTIONAL: HAL module (component) name. Defaults to "mb2hal".

HAL_MODULE_NAME=mb2hal

#OPTIONAL: Insert a delay of "FLOAT seconds" between transactions in order
#to not to have a lot of logging and facilitate the debugging.
#Useful when using DEBUG=3 (NOT INIT_DEBUG=3)
#It affects ALL transactions.
#Use "0.0" for normal activity.

SLOWDOWN=0.0

#REQUIRED: The number of total Modbus transactions. There is no maximum.

TOTAL_TRANSACTIONS=7

#One transaction section is required per transaction, starting at 00 and counting up sequentially.
#If there is a new link (not transaction), you must provide the REQUIRED parameters 1st time.
#Warning: Any OPTIONAL parameter not specified are copied from the previous transaction.

[TRANSACTION_00]
LINK_TYPE=serial
SERIAL_PORT=/dev/ttyUSB0
SERIAL_BAUD=19200
SERIAL_BITS=8
SERIAL_PARITY=none
SERIAL_STOP=1
SERIAL_DELAY_MS=2
MB_SLAVE_ID=240
MB_TX_CODE=fnct_02_read_discrete_inputs
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_02
#Update rate in Hz
MAX_UPDATE_RATE=20
DEBUG=0

[TRANSACTION_01]
MB_TX_CODE=fnct_03_read_holding_registers
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_03
MAX_UPDATE_RATE=100
DEBUG=0

[TRANSACTION_02]
MB_TX_CODE=fnct_06_write_single_register
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_06
MAX_UPDATE_RATE=100
DEBUG=0

[TRANSACTION_03]
MB_TX_CODE=fnct_15_write_multiple_coils
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_15
MAX_UPDATE_RATE=100
DEBUG=0

[TRANSACTION_04]
MB_TX_CODE=fnct_16_write_multiple_registers
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_16
MAX_UPDATE_RATE=100
DEBUG=0

[TRANSACTION_05]
MB_TX_CODE=fnct_01_read_coils
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_01
MAX_UPDATE_RATE=100
DEBUG=0

[TRANSACTION_06]
MB_TX_CODE=fnct_05_write_single_coil
FIRST_ELEMENT=0
NELEMENTS=4
HAL_TX_NAME=Modbus_fnct_05
MAX_UPDATE_RATE=100
DEBUG=0
