Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ATU on September 26, 2019, 10:35:46 AM
-
When you do an MWX or MRX, does it close the connection immediately after the instruction success? Is there a status bit to know when the connection is closed?
-
I assume you mean MODBUS over TCP. If so, no the connection does not get closed immediately, it waits for a period of time to see if more communications will be sent. There is however a maximum number of TCP connections that can be kept open at one time. If a new connection is formed when at limit, the oldest connection will be closed.
AFAIK, there isn't a connection closed status.
-
Yes Modbus over TCP. My HMI also has a limited number of connections. I have 4 BRX CPU's writing to the same MB Address and Port. Using Peerlink bits to coordinate who gets to write. Before I give permission, I would like to know when each BRX has completed its transmission and the port is closed. If I pull up a Device Status window, I see an OPEN/CLOSED status for the State. I would really like to have that status bit available.
-
Servers typically control the number of connections. There really isn't a method for the client to know that it has been closed. You would need to track this manually.
Peerlink has some structures to show when data has been updated. Se DMD0300 in the software help file for a list.
-
I don't think that is available for the Modbus/TCP Client. However, you can programmatically force the Modbus/TCP client device to close its connection with a specific slave by performing an MRX/MWX to another slave.
Have a Stage program that does all the normal read/writes to the HMI, then JMP to a SG that does an MRX back to yourself (the PLC). This will close the TCP connection to the HMI.
-
I will try that, thanks.
-
I will try that, thanks.
It's a hack, but in one way, it lets you control the "timeout". If it was 60 seconds, that non-existent bit would remain ON for 60 seconds. Now, you can control the connection to disconnect immediately. programmatically, from the HMI.
-
if you use 1 device driver in the BRX to communicate with the HMI but on 2 different ports, say 502 and 503. When you execute an MWX on 502 to the HMI and then run another MWX to 503, does it close the connection with 502 immediately?
-
I don't know. I would guess yes, for the same reason why if the IP Address was different, it would close the TCP connection on the first.