General Discussions
Write modbus data

Hi.
I want to use the DT80 to write modbus data and send it to a modbus poll application. I have matched baud rate, data bits, stop bits, slave addresses, and registers. But I found the error "Modbus master - unexpected function id in response. Expected: 6; received: 3dataTaker 80 E130 - Modbus - unexpected function id in response".

Here is my script:

begin"testmodbus"
Profile sersen_port function="MODBUS_Master"
Profile sersen_port BPS="9600"
Profile sersen_port Data_bits="8"
Profile sersen_port stop_bits="1"
Profile sersen_port parity="none"
Profile sersen_port flow="none"
Profile sersen_port mode="RS485"
Profile Modbus_Server sersen_Address="1"
p56=4

RA1S
VLITH(FF2,"Vlith~V",=100CV)
1MODBUS(AD1,R4:5,MBI,W)=100CV

runjobonreset"testmodbus"
end

Here is the output when trying to query with P56=4:

Modbus TX >SS: 01 060004000109cb (8)
Modbus RX <SS: 01 030000000ac5cd (8)
Modbus master - unexpected function id in response. Expected: 6; received: 3dataTaker 80 E130 - Modbus - unexpected function id in response

what does the error message of "unexpected function id in response. Expected: 6" mean?.

in the modbus poll application, there is an error message "insufficient bytes received"

65854e5d76bd0

Is there something wrong with the script I created or is there something wrong with the modbus poll application configuration?

Thanks.
adaahkam

Hi. I want to use the DT80 to write modbus data and send it to a modbus poll application. I have matched baud rate, data bits, stop bits, slave addresses, and registers. But I found the error &quot;Modbus master - unexpected function id in response. Expected: 6; received: 3dataTaker 80 E130 - Modbus - unexpected function id in response&quot;. Here is my script: &gt; _begin&quot;testmodbus&quot;_ _Profile sersen_port function=&quot;MODBUS_Master&quot;_ _Profile sersen_port BPS=&quot;9600&quot;_ _Profile sersen_port Data_bits=&quot;8&quot;_ _Profile sersen_port stop_bits=&quot;1&quot;_ _Profile sersen_port parity=&quot;none&quot;_ _Profile sersen_port flow=&quot;none&quot;_ _Profile sersen_port mode=&quot;RS485&quot;_ _Profile Modbus_Server sersen_Address=&quot;1&quot;_ _p56=4 _ _RA1S_ _VLITH(FF2,&quot;Vlith~V&quot;,=100CV)_ _1MODBUS(AD1,R4:5,MBI,W)=100CV_ _ runjobonreset&quot;testmodbus&quot; end_ Here is the output when trying to query with P56=4: &gt; Modbus TX &gt;SS: 01 060004000109cb (8) Modbus RX &lt;SS: 01 030000000ac5cd (8) Modbus master - unexpected function id in response. Expected: 6; received: 3dataTaker 80 E130 - Modbus - unexpected function id in response what does the error message of &quot;unexpected function id in response. Expected: 6&quot; mean?. in the modbus poll application, there is an error message &quot;insufficient bytes received&quot; ![65854e5d76bd0](serve/attachment&amp;path=65854e5d76bd0) Is there something wrong with the script I created or is there something wrong with the modbus poll application configuration? Thanks. adaahkam

Hi adaahkam,

We think there is a missing information in your case.

First, we assume you want to set the logger as a MODBUS Master; therefore, the PC would be the Slave. As a Master, you do not need to set the slave address in the logger.

So Profile sersen_port function="MODBUS_Master" and Profile Modbus_Server sersen_Address="1" are contradictory; you do not need to use the second one. Roughly speaking, the logger will ignore that part anyway due to the nature of a Master.

Second, what is the standing of your PC? How do you connect it to the logger? With the use of MODBUS RTU RT485, we assume you must use an RS485 to USB converter. Assuming that is true, what address do you set on the PC? Remember, the PC is the MODBUS Slave; thus, it must have an address. Based on the logger syntax, we assume the PC address is 1; please confirm.

Third, assuming the second issue is resolved, how do you set the register location in the PC? The logger tried to write into register address 4 using MODBUS function 3; please confirm if you have the same setting to receive it.

The last one is critical: when you use MODBUS Poll, you set the PC as a Master (Poll - request); if both PC and logger are Master, they cannot talk. Instead of MODBUS Poll, you must use MODBUS Slave apps: https://www.modbustools.com/modbus_slave.html.

If you want to use the MODBUS Poll, set the logger as a Slave.

Best regards,
dataTaker Expert

Hi adaahkam, We think there is a missing information in your case. First, we assume you want to set the logger as a MODBUS Master; therefore, the PC would be the Slave. As a Master, you do not need to set the slave address in the logger. So Profile sersen_port function=&quot;MODBUS_Master&quot; and Profile Modbus_Server sersen_Address=&quot;1&quot; are contradictory; you do not need to use the second one. Roughly speaking, the logger will ignore that part anyway due to the nature of a Master. Second, what is the standing of your PC? How do you connect it to the logger? With the use of MODBUS RTU RT485, we assume you must use an RS485 to USB converter. Assuming that is true, what address do you set on the PC? Remember, the PC is the MODBUS Slave; thus, it must have an address. Based on the logger syntax, we assume the PC address is 1; please confirm. Third, assuming the second issue is resolved, how do you set the register location in the PC? The logger tried to write into register address 4 using MODBUS function 3; please confirm if you have the same setting to receive it. The last one is critical: when you use MODBUS Poll, you set the PC as a Master (Poll - request); if both PC and logger are Master, they cannot talk. Instead of MODBUS Poll, you must use MODBUS Slave apps: https://www.modbustools.com/modbus_slave.html. If you want to use the MODBUS Poll, set the logger as a Slave. Best regards, dataTaker Expert
171
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft