MODBUS TCP Slave Issue

Sep 17, 2013 at 4:08 PM
Edited Sep 17, 2013 at 4:09 PM
Im testing MODBUS slave tool. MODBUS master application requesting 17 bytes. But MODBUS slave send more than 17 bytes. So my MODBUS master application couldn't read the data. How do I reduce transmit data to 17 bytes? I have attached wireshark files. Hope some one help me to solve this case.

Kind Regards,
Sep 17, 2013 at 4:36 PM
What is the name of your modbus master application, is there a download for it so I can try to reproduce the problem?
Sep 18, 2013 at 1:55 AM
Edited Sep 18, 2013 at 1:57 AM
Its a SCADA software. I got it (PcVue) from my company. But I saw there is a download link.
If I use Modscan slave with this SCADA software its working. Modscan is sending only 17 bytes.
Sep 24, 2013 at 2:21 AM
I downloaded PCVue and installed it on a XP VM, I setup a MODBUS master by creating a communication object under Configure->Communication->Equipment, I then created a Network, Node and Frame setting the quantity of data to 17.
I was able to connect and monitor my Modbus slave with this configuration, using PCVue-Variables, I was able to get the data correctly.
I'm wondering if I haven't configured PCVue correctly to reproduce this error.

I put some screenshots in here

Is this the correct way to setup PCVue?

Sep 24, 2013 at 5:07 AM
Yes. You are correct. I think you test only for input/output registers. But it doesn't work for input/output discrete. I have created two PcVue projects.
  1. MODBUS_InputRegister - This PcVue project read input registers. Its working
  2. MODBUS_InputStatus - This PcVue project read input discreate. But Its not working
    I have attached those projects to dropbox.
The only difference which I saw, PcVue only accept 17 bytes ( 136 discrete) if MODBUS slave transmit 17 byte. It will not accept if slave sends more than 17 bytes. :(

Sep 26, 2013 at 6:06 AM
FYI - Below reply from PcVue developer.

I just check the Wireshark and I know what is the problem.
Basically the length the slave returns is inconsistent with the size of data we request.
Actually the error should not be Incorrect Identifier but I guess it is the first time we have a slave returning with this error but this is an error.

In a Modbus Tcp/ip frame response there is 2 locations where we specify the size.
Modbus IP header
2 bytes: Transaction id
2 bytes: Protocol Id (always 0)
2 bytes: Byte Size of the Modbus request
Modbus Request
1 byte: Modbus address
1 byte: function code
1 byte: Number of data byte
N byte: Data

So for the example in Wireshark
PcVue is trying to to read 128 input bit from address 0.

So basically for the return response we expect to receive 128/8 = 16 byte of data.
So we expect the Byte size of the Modbus Request to be:
16bytes + 3 bytes so 19 bytes and if you check the reply in Wireshark the size specify is 259 bytes?!?

So we don’t accept the reply.

That is as simple as that ;-)

Your customer should correct is driver so that both the Byte size of the Modbus request and the number of data byte to be consistent i.e. for a read request Byte size of the Modbus Request = Number of data byte + 3
Oct 4, 2013 at 7:28 PM
I have uploaded a fix for this issue, PCVue is now able to read discretes from the modbus slave.

thanks for your help in identifying this issue.
Oct 5, 2013 at 1:10 AM
Great. Thanks for your help.