Hi
I am trying to switch from ClassicLadder to MB2HAL.
I have a VFD configuration in CL that works (but sometimes it issues an error)
I am doing a trial configuration in MB2HAL (in CL -ModBUS department the value changes well).
Her task:
Write the value 5.3A to the register H05 and Read the register H05 to check if the changes have occurred.
The VFD is the N700E - linyxcnc 2.7.15
the set current in H05 (1541Dec = 0605Hex) is 8.2A = 82Dec
and such is read by MB2HAL
In my opinion, the frame for shipping should be like this (and you can see that it is wrong)
01 10 0605 0001 02 0035 0012 where 0035 is the Hex record of the value 53
As you can see it doesn't work

Communication is because the value reads correctly.
Code:
loadusr -Wn bestia mb2hal config=mb2hal.ini
loadrt near names=near.speed
addf near.speed servo-thread
net spindle-cw classicladder.0.in-00 <= motion.spindle-on
net spindle-ccw classicladder.0.in-01 <= motion.spindle-forward
net spindle-start classicladder.0.in-02 <= motion.spindle-reverse
#net spindle-runmode bestia.command.00 <= classicladder.0.floatout-00
net freq bestia.HzOut.00 <= classicladder.0.floatout-01
#net sp classicladder.0.floatin-01 <= bestia.HzOut.00.float
Code:
#Infos:
#DC67 26.12.2019
#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
#Initialisierung:
[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=1
#OPTIONAL: HAL module (component) name. Defaults to "mb2hal".
HAL_MODULE_NAME=bestia
#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=2
#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]
#Fehler aus FU einlesen:
#Der FU hat verschiedene Fehlermeldungen, diese werden hier alle eingelesen
#NOTSTOP Funktion!
#St500 Adresse: 0x8000 (-> 32768 Dez)
#Allgememeine Kommunkitaktionseinstellungen:
LINK_TYPE=Serial
SERIAL_PORT=/dev/ttyUSB0
SERIAL_BAUD=9600
#Data bits. One of 5,6,7,8.
SERIAL_BITS=8
#Data parity. One of: even, odd, none.
SERIAL_PARITY=none
#Stop bits. One of 1, 2.
SERIAL_STOP=1
#Serial port delay between for this transaction only.
#In ms. Defaults to 0.
# AC10 does not keep up if this value is too small
SERIAL_DELAY_MS=0
MB_SLAVE_ID=1
##St500 Adresse: 0x8000 (-> 32768 Dez)
#dla falowninka N700E rejest dla CW CCW STOP to 0002hex inaczej 2dec
#FIRST_ELEMENT= pierwszy nr. rejsetru
#udaga wartośc ject podawana w dec ale nie może być 2 trzeba uzupoełnic puste 0002
FIRST_ELEMENT=1541
#z nieznanych przyczyn polecienie PIN_NAMES=runmode niedziała zastępujue je NELEMENTS=(tu można tylko liczby)
#PIN_NAMES=runmode
NELEMENTS=1
#REQUIRED: Modbus transaction function code (see www.modbus.org specifications).
# fnct_03_read_holding_registers (03 = 0x03)
# fnct_06_write_single_register (06 = 0x06)
#REQUIRED: Modbus transaction function code (see www.modbus.org specifications).
# fnct_02_read_discrete_inputs (02 = 0x02)
# fnct_03_read_holding_registers (03 = 0x03)
# fnct_04_read_input_registers (04 = 0x04)
# fnct_15_write_multiple_coils (15 = 0x0F)
# fnct_16_write_multiple_registers (16 = 0x10)
#fnct_02_read_discrete_inputs: creates boolean output HAL pins.
#fnct_03_read_holding_registers: creates a floating point output HAL pins.
# also creates a u32 output HAL pins.
#fnct_04_read_input_registers: creates a floating point output HAL pins.
# also creates a u32 output HAL pins.
#fnct_15_write_multiple_coils: creates boolean input HAL pins.
#fnct_16_write_multiple_registers: creates a floating point input HAL pins.
#The pins are named based on component name, transaction number and order number.
#Example: mb2hal.00.01 (transaction=00, second register=01 (00 is the first one))
#fnct_03_read_holding_registers: creates a floating point output HAL pins, also creates a u32 output HAL pins.
#The pins are named based on component name, transaction number and order number.
#Example: mb2hal.00.01 (transaction=00, second register=01 (00 is the first one))
# funkca 06 niedziała MB_TX_CODE=fnct_06_write_single_register
MB_TX_CODE=fnct_03_read_holding_registers
#OPTIONAL: Response timeout for this transaction. In INTEGER ms. Defaults to 500 ms
#This is how much to wait for 1st byte before raise an error.
##St500: Kein Wert angegeben, jedoch mit 250ms getestet!
MB_RESPONSE_TIMEOUT_MS=500
#OPTIONAL: Byte timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
#This is how much to wait from byte to byte before raise an error.
##St500: Kein Wert angegeben, jedoch mit 250ms getestet!
MB_BYTE_TIMEOUT_MS=500
#OPTIONAL: Instead of giving the transaction number, use a name.
#Example: mb2hal.00.01 could become mb2hal.plcin.01
#The name must not exceed 32 characters.
#NOTE: when using names be careful that you dont end up with two transactions
#usign the same name.
HAL_TX_NAME=A
#OPTIONAL: Maximum update rate in HZ. Defaults to 0.0 (0.0 = as soon as available = infinit).
#NOTE: This is a maximum rate and the actual rate may be lower.
#If you want to calculate it in ms use (1000 / required_ms).
#Example: 100 ms = MAX_UPDATE_RATE=10.0, because 1000.0 ms / 100.0 ms = 10.0 Hz
MAX_UPDATE_RATE=100
#OPTIONAL: Debug level for this transaction only.
#See INIT_DEBUG parameter above.
DEBUG=0
#[TRANSACTION_01]
#read control register
#MB_TX_CODE=fnct_16_write_multiple_registers
#FIRST_ELEMENT=1541
#NELEMENTS=1
#HAL_TX_NAME=HzOut
#MAX_UPDATE_RATE=100.0
#DEBUG=0
[TRANSACTION_01]
MB_TX_CODE=fnct_16_write_multiple_registers
FIRST_ELEMENT=1541
NELEMENTS=1
HAL_TX_NAME=HzOut
MAX_UPDATE_RATE=100.0
DEBUG=3
www.forum.linuxcnc.org/10-advanced-confi...nuxcnc-2-7-14#229642
I helped myself with this
github.com/swepeter/PrintNC/tree/11a4edd...eea4399d0a321ed9a344