Hello, (author of the hm2_modbus driver calling...)
First, what is the error code generated? See the hm2_modbus.0.command.NN.error-code pins.
Second, what LCNC version are you using?
Just a comment on the attached documentation image:
Reading and writing registers are, in modbus terms, always multiples of word (2-byte) quantities. The image with the "Home position return speed" at register address 0x6099 states a /single byte/ and then two 4-byte words. The documentation is slightly misleading. It states in the next column that 5 registers are actually involved, so that would indicate that the first is masked to a byte sized value (masking is not supported or performed by the hm2_modbus driver). The 5-register statement in the table would also fix the problem of having 32-bit words seemingly on a odd address boundary. But with 5 registers, then the "number of entries" value is at address 0x6099 and the two 32-bit words are at 0x609a and 0x609c resp.. BTW, I notice the interesting mixed endianess of the 32-bit values...
The read operation seems to work as intended, but the write operation fails. The failure is apparently not a problem of the mbccs file. It is an error message of the hm2_modbus driver that indicates something odd is happening.
When compiling the mbccs file I get a couple of warnings (using first file below):
mrje70a.mbccs: warning: Multi-register type 'U_CDAB' not aligned to natural boundary in commands/command[1]/pin[2]
mrje70a.mbccs: warning: Multi-register type 'U_CDAB' not aligned to natural boundary in commands/command[1]/pin[3]
mrje70a.mbccs: warning: Multi-register type 'U_CDAB' not aligned to natural boundary in commands/command[2]/pin[2]
mrje70a.mbccs: warning: Multi-register type 'U_CDAB' not aligned to natural boundary in commands/command[2]/pin[3]
But, that should not be the case. This is an error in mesambccc not being able to count correctly. Using the --verbose option clearly shows the address to be even. I have to investigate and see what is happening. I am guessing that the hm2_modbus error is secondary to an error in mesambccc when setting the command and pin fields for the command lists. As a temporary fix: splitting the read and write commands into two separate commands makes the warnings go away (second source below). It /might/ fix the read/write issue you are having. The downside is that the read/write no longer is one single modbus transaction. That may or may not be a problem, depending the device.
The way you wrote the definition should work. I'd write it like:
[code][code][code]<?xml version="1.0" encoding="UTF-8"?>
[code]<mesamodbus baudrate="115200" parity="E" stopbits="1">
<devices><device address="0x02" name="mrje70a"/></devices>
<initlist />
<commands>
<command device="mrje70a" function="R_REGISTERS" address="0x6099" haltype="HAL_U32">
<pin name="rnumentries" modbustype="U_AB"/>
<pin name="rspeedss" modbustype="U_CDAB"/>
<pin name="rspeedsz" modbustype="U_CDAB"/>
</command>
<command device="mrje70a" function="W_REGISTERS" address="0x6099" haltype="HAL_U32">
<pin name="wnumentries" modbustype="U_AB"/>
<pin name="wspeedss" modbustype="U_CDAB"/>
<pin name="wspeedsz" modbustype="U_CDAB"/>
</command>
</commands>
</mesamodbus>
---
<?xml version="1.0" encoding="UTF-8"?>
<mesamodbus baudrate="115200" parity="E" stopbits="1">
<devices><device address="0x02" name="mrje70a"/></devices>
<initlist />
<commands>
<command device="mrje70a" function="R_REGISTERS" address="0x6099" haltype="HAL_U32">
<pin name="rnumentries" modbustype="U_AB"/>
</command>
<command device="mrje70a" function="R_REGISTERS" address="0x609a" haltype="HAL_U32">
<pin name="rspeedss" modbustype="U_CDAB"/>
<pin name="rspeedsz" modbustype="U_CDAB"/>
</command>
<command device="mrje70a" function="W_REGISTERS" address="0x6099" haltype="HAL_U32">
<pin name="wnumentries" modbustype="U_AB"/>
</command>
<command device="mrje70a" function="W_REGISTERS" address="0x609a" haltype="HAL_U32">
<pin name="wspeedss" modbustype="U_CDAB"/>
<pin name="wspeedsz" modbustype="U_CDAB"/>
</command>
</commands>
</mesamodbus>
[/code][/code][/code][/code]