Import LinuxCNC source tree
This commit is contained in:
18
tests/mb2hal/mb2hal.1a/checkresult
Executable file
18
tests/mb2hal/mb2hal.1a/checkresult
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TESTDIR=$(dirname "$1")
|
||||
cd "${TESTDIR}"
|
||||
|
||||
# HAL assigns each component a unique component ID at load-time.
|
||||
# The RTAI and uspace HAL implementations assign different component IDs,
|
||||
# so remove all mentions of specific component IDs from the result file,
|
||||
# so that a single `expected` file works for both.
|
||||
sed --in-place --regexp-extended --expression='s/^(.*unloading HAL module \[)[0-9]+(.*)$/\1(ignored comp id)\2/' result
|
||||
|
||||
# The SIGQUIT signal does not arrive at a well-defined time, so don't
|
||||
# check for that debug log message. The rest of the shutdown messages
|
||||
# seem to have well-defined order.
|
||||
sed --in-place --regexp-extended --expression='/^mb2hal quit_signal DEBUG: signal \[15\] received$/d' result
|
||||
|
||||
diff -u expected result
|
||||
131
tests/mb2hal/mb2hal.1a/expected
Normal file
131
tests/mb2hal/mb2hal.1a/expected
Normal file
@@ -0,0 +1,131 @@
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [INIT_DEBUG] [3]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [VERSION] [1000]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [HAL_MODULE_NAME] [mb2hal]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [SLOWDOWN] [0.000]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [TOTAL_TRANSACTIONS] [5]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MAX_UPDATE_RATE] [20.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_TX_CODE] [fnct_02_read_discrete_inputs] [1]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [HAL_TX_NAME] [Modbus_fnct_02]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 0 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_TX_CODE] [fnct_03_read_holding_registers] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [HAL_TX_NAME] [Modbus_fnct_03]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 1 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_TX_CODE] [fnct_06_write_single_register] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [HAL_TX_NAME] [Modbus_fnct_06]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 2 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_TX_CODE] [fnct_15_write_multiple_coils] [5]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [HAL_TX_NAME] [Modbus_fnct_15]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 3 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_TX_CODE] [fnct_16_write_multiple_registers] [6]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [HAL_TX_NAME] [Modbus_fnct_16]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 4 OK
|
||||
mb2hal main OK: parse_ini_file done OK
|
||||
mb2hal init_mb_links DEBUG: LINK 0 (RTU) link_type[0] device[/dev/ttyUSB0] baud[19200] data[8] parity[N] stop[1] fd[-1]
|
||||
mb2hal main OK: init_gbl.mb_link done OK
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 0 lk_n[0] tx_n[0] cfg_dbg[0] lk_dbg[0] t_inc[0.050] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 1 lk_n[0] tx_n[1] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 2 lk_n[0] tx_n[2] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 3 lk_n[0] tx_n[3] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 4 lk_n[0] tx_n[4] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal main OK: init_gbl.mb_tx done OK
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.03]
|
||||
mb2hal main OK: HAL components created OK
|
||||
mb2hal main OK: Link thread loop and logic 0 created OK
|
||||
mb2hal main OK: mb2hal is running
|
||||
mb2hal quit_cleanup DEBUG: started
|
||||
mb2hal quit_cleanup DEBUG: unloading HAL module [(ignored comp id)] ret[0]
|
||||
mb2hal quit_cleanup DEBUG: done OK
|
||||
mb2hal main OK: going to exit!
|
||||
89
tests/mb2hal/mb2hal.1a/mb2hal.ini
Normal file
89
tests/mb2hal/mb2hal.1a/mb2hal.ini
Normal file
@@ -0,0 +1,89 @@
|
||||
#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: 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=5
|
||||
|
||||
#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
|
||||
|
||||
|
||||
1
tests/mb2hal/mb2hal.1a/musthave
Normal file
1
tests/mb2hal/mb2hal.1a/musthave
Normal file
@@ -0,0 +1 @@
|
||||
LIBMODBUS3
|
||||
1
tests/mb2hal/mb2hal.1a/readme
Normal file
1
tests/mb2hal/mb2hal.1a/readme
Normal file
@@ -0,0 +1 @@
|
||||
This test runs mb2hal im compatibility mode (means version = 1.0, not explicitly set) compares the INI DEBUG output of MB2HAL.
|
||||
2
tests/mb2hal/mb2hal.1a/test.hal
Normal file
2
tests/mb2hal/mb2hal.1a/test.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
# Load MB2HAL
|
||||
loadusr -W mb2hal config=mb2hal.ini
|
||||
13
tests/mb2hal/mb2hal.1b/checkresult
Executable file
13
tests/mb2hal/mb2hal.1b/checkresult
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TESTDIR=$(dirname "$1")
|
||||
cd "${TESTDIR}"
|
||||
|
||||
# HAL assigns each component a unique component ID at load-time.
|
||||
# The RTAI and uspace HAL implementations assign different component IDs,
|
||||
# so remove all mentions of specific component IDs from the result file,
|
||||
# so that a single `expected` file works for both.
|
||||
sed --in-place --regexp-extended --expression='s/^( *)[0-9]+(.*mb2hal.Modbus_fnct_.*)$/\1(ignored comp id)\2/' result
|
||||
|
||||
diff -u expected result
|
||||
39
tests/mb2hal/mb2hal.1b/expected
Normal file
39
tests/mb2hal/mb2hal.1b/expected
Normal file
@@ -0,0 +1,39 @@
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03
|
||||
|
||||
89
tests/mb2hal/mb2hal.1b/mb2hal.ini
Normal file
89
tests/mb2hal/mb2hal.1b/mb2hal.ini
Normal file
@@ -0,0 +1,89 @@
|
||||
#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=0
|
||||
|
||||
#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=5
|
||||
|
||||
#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
|
||||
|
||||
|
||||
1
tests/mb2hal/mb2hal.1b/musthave
Normal file
1
tests/mb2hal/mb2hal.1b/musthave
Normal file
@@ -0,0 +1 @@
|
||||
LIBMODBUS3
|
||||
1
tests/mb2hal/mb2hal.1b/readme
Normal file
1
tests/mb2hal/mb2hal.1b/readme
Normal file
@@ -0,0 +1 @@
|
||||
This test runs mb2hal im compatibility mode (means version = 1.0, not explicitly set) and compares the created pins (including types).
|
||||
10
tests/mb2hal/mb2hal.1b/test.hal
Normal file
10
tests/mb2hal/mb2hal.1b/test.hal
Normal file
@@ -0,0 +1,10 @@
|
||||
# Load MB2HAL
|
||||
loadusr -W mb2hal config=mb2hal.ini
|
||||
|
||||
# specifying these pins so detailed to avoid varying values of
|
||||
# mb2hal.<MB_TX_CODE>.num_errors
|
||||
show pin mb2hal.Modbus_fnct_02.0
|
||||
show pin mb2hal.Modbus_fnct_03.0
|
||||
show pin mb2hal.Modbus_fnct_06.0
|
||||
show pin mb2hal.Modbus_fnct_15.0
|
||||
show pin mb2hal.Modbus_fnct_16.0
|
||||
18
tests/mb2hal/mb2hal.2a/checkresult
Executable file
18
tests/mb2hal/mb2hal.2a/checkresult
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TESTDIR=$(dirname "$1")
|
||||
cd "${TESTDIR}"
|
||||
|
||||
# HAL assigns each component a unique component ID at load-time.
|
||||
# The RTAI and uspace HAL implementations assign different component IDs,
|
||||
# so remove all mentions of specific component IDs from the result file,
|
||||
# so that a single `expected` file works for both.
|
||||
sed --in-place --regexp-extended --expression='s/^(.*unloading HAL module \[)[0-9]+(.*)$/\1(ignored comp id)\2/' result
|
||||
|
||||
# The SIGQUIT signal does not arrive at a well-defined time, so don't
|
||||
# check for that debug log message. The rest of the shutdown messages
|
||||
# seem to have well-defined order.
|
||||
sed --in-place --regexp-extended --expression='/^mb2hal quit_signal DEBUG: signal \[15\] received$/d' result
|
||||
|
||||
diff -u expected result
|
||||
177
tests/mb2hal/mb2hal.2a/expected
Normal file
177
tests/mb2hal/mb2hal.2a/expected
Normal file
@@ -0,0 +1,177 @@
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [INIT_DEBUG] [3]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [VERSION] [1001]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [HAL_MODULE_NAME] [mb2hal]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [SLOWDOWN] [0.000]
|
||||
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [TOTAL_TRANSACTIONS] [7]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MAX_UPDATE_RATE] [20.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_TX_CODE] [fnct_02_read_discrete_inputs] [1]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [HAL_TX_NAME] [Modbus_fnct_02]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 0 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_01] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [MB_TX_CODE] [fnct_03_read_holding_registers] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_01] [HAL_TX_NAME] [Modbus_fnct_03]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 1 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_02] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [MB_TX_CODE] [fnct_06_write_single_register] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_02] [HAL_TX_NAME] [Modbus_fnct_06]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 2 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_03] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [MB_TX_CODE] [fnct_15_write_multiple_coils] [5]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_03] [HAL_TX_NAME] [Modbus_fnct_15]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 3 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_04] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [MB_TX_CODE] [fnct_16_write_multiple_registers] [6]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_04] [HAL_TX_NAME] [Modbus_fnct_16]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 4 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_05] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [MB_TX_CODE] [fnct_01_read_coils] [7]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_05] [HAL_TX_NAME] [Modbus_fnct_01]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 5 OK
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [LINK_TYPE] [serial] [0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_PORT] [/dev/ttyUSB0]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_BAUD] [19200]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_BITS] [8]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_PARITY] [none]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_STOP] [1]
|
||||
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_06] [SERIAL_DELAY_MS] [2]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [MB_SLAVE_ID] [240]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [FIRST_ELEMENT] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [NELEMENTS] [4]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [MAX_UPDATE_RATE] [100.000]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [MB_RESPONSE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [MB_BYTE_TIMEOUT_MS] [500]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [DEBUG] [0]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [MB_TX_CODE] [fnct_05_write_single_coil] [8]
|
||||
mb2hal parse_transaction_section DEBUG: [TRANSACTION_06] [HAL_TX_NAME] [Modbus_fnct_05]
|
||||
mb2hal parse_ini_file OK: parse_transaction_section 6 OK
|
||||
mb2hal main OK: parse_ini_file done OK
|
||||
mb2hal init_mb_links DEBUG: LINK 0 (RTU) link_type[0] device[/dev/ttyUSB0] baud[19200] data[8] parity[N] stop[1] fd[-1]
|
||||
mb2hal main OK: init_gbl.mb_link done OK
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 0 lk_n[0] tx_n[0] cfg_dbg[0] lk_dbg[0] t_inc[0.050] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 1 lk_n[0] tx_n[1] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 2 lk_n[0] tx_n[2] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 3 lk_n[0] tx_n[3] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 4 lk_n[0] tx_n[4] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 5 lk_n[0] tx_n[5] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal init_mb_tx DEBUG: MB_TX 6 lk_n[0] tx_n[6] cfg_dbg[0] lk_dbg[0] t_inc[0.010] nxt_t[0.000]
|
||||
mb2hal main OK: init_gbl.mb_tx done OK
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.Modbus_fnct_02.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [1] pin_name [mb2hal.Modbus_fnct_03.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [2] pin_name [mb2hal.Modbus_fnct_06.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [3] pin_name [mb2hal.Modbus_fnct_15.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [4] pin_name [mb2hal.Modbus_fnct_16.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [5] pin_name [mb2hal.Modbus_fnct_01.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [5] pin_name [mb2hal.Modbus_fnct_01.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [5] pin_name [mb2hal.Modbus_fnct_01.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [5] pin_name [mb2hal.Modbus_fnct_01.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [5] pin_name [mb2hal.Modbus_fnct_01.03]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [6] pin_name [mb2hal.Modbus_fnct_05.num_errors]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [6] pin_name [mb2hal.Modbus_fnct_05.00]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [6] pin_name [mb2hal.Modbus_fnct_05.01]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [6] pin_name [mb2hal.Modbus_fnct_05.02]
|
||||
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [6] pin_name [mb2hal.Modbus_fnct_05.03]
|
||||
mb2hal main OK: HAL components created OK
|
||||
mb2hal main OK: Link thread loop and logic 0 created OK
|
||||
mb2hal main OK: mb2hal is running
|
||||
mb2hal quit_cleanup DEBUG: started
|
||||
mb2hal quit_cleanup DEBUG: unloading HAL module [(ignored comp id)] ret[0]
|
||||
mb2hal quit_cleanup DEBUG: done OK
|
||||
mb2hal main OK: going to exit!
|
||||
110
tests/mb2hal/mb2hal.2a/mb2hal.ini
Normal file
110
tests/mb2hal/mb2hal.2a/mb2hal.ini
Normal file
@@ -0,0 +1,110 @@
|
||||
#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
|
||||
1
tests/mb2hal/mb2hal.2a/musthave
Normal file
1
tests/mb2hal/mb2hal.2a/musthave
Normal file
@@ -0,0 +1 @@
|
||||
LIBMODBUS3
|
||||
1
tests/mb2hal/mb2hal.2a/readme
Normal file
1
tests/mb2hal/mb2hal.2a/readme
Normal file
@@ -0,0 +1 @@
|
||||
This test runs mb2hal with VERSION=1.1 and compares the INI DEBUG output of MB2HAL.
|
||||
2
tests/mb2hal/mb2hal.2a/test.hal
Normal file
2
tests/mb2hal/mb2hal.2a/test.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
# Load MB2HAL
|
||||
loadusr -W mb2hal config=mb2hal.ini
|
||||
13
tests/mb2hal/mb2hal.2b/checkresult
Executable file
13
tests/mb2hal/mb2hal.2b/checkresult
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TESTDIR=$(dirname "$1")
|
||||
cd "${TESTDIR}"
|
||||
|
||||
# HAL assigns each component a unique component ID at load-time.
|
||||
# The RTAI and uspace HAL implementations assign different component IDs,
|
||||
# so remove all mentions of specific component IDs from the result file,
|
||||
# so that a single `expected` file works for both.
|
||||
sed --in-place --regexp-extended --expression='s/^( *)[0-9]+(.*mb2hal.Modbus_fnct_.*)$/\1(ignored comp id)\2/' result
|
||||
|
||||
diff -u expected result
|
||||
69
tests/mb2hal/mb2hal.2b/expected
Normal file
69
tests/mb2hal/mb2hal.2b/expected
Normal file
@@ -0,0 +1,69 @@
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.00.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.01.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.02.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_02.03.bit-inv
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int
|
||||
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float
|
||||
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.00.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.01.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.02.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_06.03.int
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03.bit
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.00.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.01.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.02.int
|
||||
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03.float
|
||||
(ignored comp id) s32 IN 0 mb2hal.Modbus_fnct_16.03.int
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.00.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.00.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.01.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.01.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.02.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.02.bit-inv
|
||||
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_01.03.bit
|
||||
(ignored comp id) bit OUT TRUE mb2hal.Modbus_fnct_01.03.bit-inv
|
||||
|
||||
Component Pins:
|
||||
Owner Type Dir Value Name
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.00.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.01.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.02.bit
|
||||
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_05.03.bit
|
||||
|
||||
110
tests/mb2hal/mb2hal.2b/mb2hal.ini
Normal file
110
tests/mb2hal/mb2hal.2b/mb2hal.ini
Normal file
@@ -0,0 +1,110 @@
|
||||
#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=0
|
||||
|
||||
#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
|
||||
1
tests/mb2hal/mb2hal.2b/musthave
Normal file
1
tests/mb2hal/mb2hal.2b/musthave
Normal file
@@ -0,0 +1 @@
|
||||
LIBMODBUS3
|
||||
1
tests/mb2hal/mb2hal.2b/readme
Normal file
1
tests/mb2hal/mb2hal.2b/readme
Normal file
@@ -0,0 +1 @@
|
||||
This test runs mb2hal with VERSION=1.1 and compares the created pins (including types).
|
||||
12
tests/mb2hal/mb2hal.2b/test.hal
Normal file
12
tests/mb2hal/mb2hal.2b/test.hal
Normal file
@@ -0,0 +1,12 @@
|
||||
# Load MB2HAL
|
||||
loadusr -W mb2hal config=mb2hal.ini
|
||||
|
||||
# specifying these pins so detailed to avoid varying values of
|
||||
# mb2hal.<MB_TX_CODE>.num_errors
|
||||
show pin mb2hal.Modbus_fnct_02.0
|
||||
show pin mb2hal.Modbus_fnct_03.0
|
||||
show pin mb2hal.Modbus_fnct_06.0
|
||||
show pin mb2hal.Modbus_fnct_15.0
|
||||
show pin mb2hal.Modbus_fnct_16.0
|
||||
show pin mb2hal.Modbus_fnct_01.0
|
||||
show pin mb2hal.Modbus_fnct_05.0
|
||||
Reference in New Issue
Block a user