Homebrewed software to communicate with measuring device via Modbus TCP

Good morning dear society,

I have been trying to make software to enable me communicate with MC760 Iskra current, voltage, power measure device from my laptop. The device on its rear has Ethernet port. The software in its current state enables me to establish TCP connection, sending command symbol string to the device and receiving data from it.
The question is that every time when I send command string, device responds immediately with exactly the same data. The data those I expect is current values. For example when software sends command symbol string(frame):

1234 0000 0004 21 03 75AE 0002
An orbitary Protocol ID. Byte Device ID Functionality Register Register quantity.
value, transaction quantity. 33 is decimal code 03 means address
ID. 21 is hex. retrieving data 75AE is hex
from device. corresponds to
30126 decimal.
As I mentioned above my device returns exactly the same string.
Appearance of this tiny software please have a look at below:

modbus TCP.PNG
Can anyone kindly take me to understanding the essence of making device responding to the request?

Faithfully yours.
 
What TCP port are you targeting? If you are trying to communicate Modbus/TCP to the device, you must use port 502.

If you are using another port number, I think the power analyzer believes you are making a "terminal type of connection", which may be why it's simply echoing your requests. See the Local Port description on page 64 of the manual here:
https://www.iskra.eu/f/docs/15422/K_MC7x0A_EN_22440500_Users_manual_Ver_1.00.pdf

If you haven't done so already, try using a Modbus/TCP client tool to confirm Modbus communications with the power analyzer, such as ModScan, Simply Modbus, Modbus Poll, etc.
 
What TCP port are you targeting? If you are trying to communicate Modbus/TCP to the device, you must use port 502.

If you are using another port number, I think the power analyzer believes you are making a "terminal type of connection", which may be why it's simply echoing your requests. See the Local Port description on page 64 of the manual here:
https://www.iskra.eu/f/docs/15422/K_MC7x0A_EN_22440500_Users_manual_Ver_1.00.pdf

If you haven't done so already, try using a Modbus/TCP client tool to confirm Modbus communications with the power analyzer, such as ModScan, Simply Modbus, Modbus Poll, etc.
Thank you sincere, sir.
I 'll follow your suggestions!
 
What TCP port are you targeting? If you are trying to communicate Modbus/TCP to the device, you must use port 502.

If you are using another port number, I think the power analyzer believes you are making a "terminal type of connection", which may be why it's simply echoing your requests. See the Local Port description on page 64 of the manual here:
https://www.iskra.eu/f/docs/15422/K_MC7x0A_EN_22440500_Users_manual_Ver_1.00.pdf

If you haven't done so already, try using a Modbus/TCP client tool to confirm Modbus communications with the power analyzer, such as ModScan, Simply Modbus, Modbus Poll, etc.
Dear sir,

I changed on MC 760 settings /communication/TCP Port/ from 10001 to 502
In Winsock propertie I changed "Local port" and "Remote port" both were 10001 to 502
I restarted the MC760

MC 760 is still echoing when responses requests.

Please have a look on photoes I attached.

Faithfully.
 

Attachments

[off topic]: Nice, I installed lots of Brands kilns for Iskra Feriti in Ljubljana, was in the 90's after the war.
Really nice people, and very beautiful nice country.
Didn't know they also made this equipment.
 
Dear sir,

I changed on MC 760 settings /communication/TCP Port/ from 10001 to 502
In Winsock propertie I changed "Local port" and "Remote port" both were 10001 to 502
I restarted the MC760

MC 760 is still echoing when responses requests.

Please have a look on photoes I attached.

Faithfully.
According to the manual, the MC 760 has two open ports: port 502 for Modbus/TCP and a user defined port. Therefore, there is no need to set any ports on the MC 760 because it always has port 502 open.

From the manual:
When port 502 is used a remote application(s) can access device regardless the setting for Local Port in a device. This setting is applicable only when terminal access is required.

The user defined port is likely what you are changing by configuring "settings /communication/TCP Port/". The user defined port is a "terminal type of connection".

Therefore, do not set "settings /communication/TCP Port/" to port 502, otherwise the MC 760 may believe you want a "terminal type of connection" on that port. Change this setting back to 10001 and try your test again.

If you are still having issues, you need to determine if the problem is with your software or with the MC 760. This can be done using a third-party Modbus/TCP client tool, as mentioned in my previous response.
 
I just looked at this again, and your request is invalid. You are sending the following bytes:
1234 0000 0004 21 03 75AE 0002

Which decodes into the following:
Transaction Identifier: 4660 (0x1234)
Protocol Identifier: 0
Length: 4 Incorrect, should be 6
Unit Identifier: 33 (0x21) This may need to be changed, perhaps to 1. Most Modbus/TCP devices either ignore this field or require it to be set to 1 or 0.
Function Code: 3 (Read Holding Registers) See next line
Reference Number: 30126 (0x75AE) This is accessing register 430127 (aka Holding Register 30127), which doesn't exist on the device.
Quantity of Registers: 2

Try the following command:
1234 0000 0006 01 04 0070 0002

The command above reads Average Phase Voltage U~ from the power analyzer, which is register 30113 (aka Input Register 113, i.e. Function Code 4, Reference Number 112).
 
Good morning dear sir!

Yesterday and today morning after I read suggestions you directed me, I made some changes to Winsock control that manages connection with MC760. First of all as you kindly suggested I reverted on MC760 local TCP port to 10001. Then I spread Winsock fields and found "Remote port" and "Local port". Both fields filled 502, I changed "Remote port" to 502, and "Local port" to 1025. 1025 according to Modbus over TCP specification:
" • Connection establishment : The MODBUS messaging service must provide a listening socket on Port 502, which permits to accept new connection and to exchange data with other devices. When the messaging service needs to exchange data with a remote server, it must open a new client connection with a remote Port 502 in order to exchange data with this distant. The local port must be higher than 1024 and different for each client connection. " Please have a look at page 12 of an attached file.
Then I ran my application it estimated me "Connecting to remote host", and then "Error occured":
software local 1025 remote 502.PNG

local 1025 remote 502.PNG
After this I changed this Winsock to: Local 502, Remote 502. It established some kind of connection(terminal), input the correct command string, and it estimated this:
Correct mb sting input.PNG
local 502 remote 502.PNG

Port 502 seems to be closed on MC 760. Is port 502 part of memory allocated for the Modbus input? Are there any means to show port 502 current state on MC760? Or change it?

Yours faithfully.
 

Attachments

Please try a Modbus/TCP client tool to confirm Modbus communications with the MC 760, such as ModScan, Simply Modbus, Modbus Poll, etc.

After you have confirmed successful Modbus communications and confirmed the MC 760 can properly communicate Modbus with a third-party tool, then try getting your own software to work.

Wireshark will be a big help here. Take a Wireshark capture of successful communications using a third-party client software tool and compare it to a capture using your software to look for differences.
 
Good evening dear sir,

I installed Modbus Poll on my notebook, from which I try to make modbus connection with use of my software.
It estimated me as follows: I switch on MC760, and switched off homemade software. Then I ran modbus poll software as administrator. After modbus poll made its appearance as a main window, I pressed F3 button:
modbus poll 1.PNG

Then I set up with Modbus TCP/IP protocol, inserted ip address 192.168.1.13 of MC 760 and connect timeout of 10000ms and clicked "OK" button, the result appeared:
modbus poll 2.PNG

What do I do with this?
Does IP address change on MC 760 affect its modbus connection performance?
Initially on that MC 760 IP address was 192.168.0.2; But I changed it to 192.168.1.13 to fit Winsock connection sub network.

Faithfully.
 
The IP addresses of the MC 760 and your computer are very important!

They must be on a compatible subnet.

For example:
Computer:
IP Address: 192.168.1.12
Subnet Mask: 255.255.255.0

MC 760:
IP Address: 192.168.1.13
Subnet Mask: 255.255.255.0

Please note that you may need to power cycle the MC 760 after configuring its IP Address settings for the changes to take effect.
 
Sometimes you also need to adjust the gateway to 192.168.1.254
Good morning dear gentlemen,

Initially there was an IP 192.168.0.2, afterwards I changed It to 192.168.1.13 to fit Winsock control subnet.
From yesterday I have been trying to establish modbus connection with Modbus Poll third party software, and assumed that connection issues could happen from changing communication settings on MC, returned them all to factory values.
These are on MC:
IP 192.168.0.2
Device ID 33
Subnet mask: 255.255.255.0
TCP port 10001

As you kindly suggested me I toggled the gateway to 192.168.1.254, but since IP's been changed to 192.168.0.2 I typed 192.168.0.254 , please have a look at all pictures below.
6.PNG

7.PNG

8.PNG

9.PNG

10.PNG

11.PNG

20201126_093712.jpg

Faithfully.
 
Its a pity I don't have this Iskra MC750 at hand over here. Because I'm sure I get it working with a Pro-face touchpanel in just a few minutes.
If you connect this MC750 to your PC directly with a ethernet cable, there is a chance you need to use a crossed cable https://en.wikipedia.org/wiki/Ethernet_crossover_cable
Modern equipment nowadays is auto sensing and you can use just a standard cable, but with older equipment its not.
You could also use a switch of course between the MC750 and your PC, then you can use standard 1:1 ethernet cables.
 
There is also another important thing with regard to modbus TCP (and RTU). I had these problems a lot while using the default driver settings in Pro-face touchpanels.
Of course you have the port 1024 (must be enabled by the way on your pc!!!) and the IP addresses of a few modbus TCP slaves (see picture below right-bottom). Port 502 must also be enabled.
I have here 7 modbus RTU (serial) slaves connected with a modbus RTU->TCP convertor to a Pro-face touchpanel.
This convertor has address 10.0.50.101 and I need to set the addresses of the serial modules. I included an example setting of a the 3rd THVA1 thyristor module. It has modbus RTU address 3. It is mapped over 10.0.50.101 (the modbus TCP->RTU convertor) with port 502 and modbus address 3 (pro face calls this Unit ID)
Now there is an important thing I found.
For each slave I can set which commands are used on the modbus for read/write and by default in the Pro-face driver this is set wrong.
When using modbus addresses 400001 etc. (for data word read/write, probably also what you will use) I need to set the modbus command to single read and single write. By default in Pro-face this is set to multiple read/write, but most modules cannot work correctly that way.
So I often use the custom settings for each slave, and change the read and write for 400001 registers manually to read (03) and write (06) iso of the default values.
Otherwise I get communication errors.
Maybe this can shine a light on your problems, you never know.

Modbus TCP.jpg
 

Attachments

Of course you have the port 1024 (must be enabled by the way on your pc!!!) and the IP addresses of a few modbus TCP slaves (see picture below right-bottom). Port 502 must also be enabled.
Good morning dear sir!

Can you kindly write me how should ports 1024 and 502 get enabled on my PC?

May be the problem is just Windows which prevents Modbus connection from being succeded on PC?
Because I did not command Windows to open Modbus specific ports(502 and 1024).

The third party software "Modbus Poll" runs under Windows 10 on my PC, and I run this software "As administrator".

Faithfully.
 
Gentlemen,
Your kindly suggestion on swapping wires inside ethernet cable(crossover cable) helped, and with Goodness Modbus TCP conection's been established!
Please have a look at pics below:
15.PNG

What fixes that "Timeout Error" matter?

Faithfully.
 
Top