Com thru SCM 485 As Master needs reset

We have a data acquisition system communicating with 20 Watlow F4 and Watlow F4T’s. We are using the Modbus subroutine as Master with a 3 wire serial drop to the slaves. We always leave the communication “open” but after a time of not communicating with an f4T, it wont establish com. The only way i have found is to restart the strategy,

I was reading about the commands and saw that you can query the com handle if it is open (and it will be), but the other side has closed and it is in a “half open” state. Could this be our problem?
How can i query if the other side is ready? or is there a command to reset the com handle?

When we monitor the RS485 duplex line (for weeks with an oscilloscope) the problem doesn’t happen. Needs solution, I cant restart the strategy every time We want to establish com. any ideas?

This typically wouldn’t be the case with a serial connection, however the PAC with a serial module functions like a TCP to serial bridge. I’ve never have left a serial connection open without using it so have never experienced the issue you are having, but I do wonder if the internal TCP server is closing the connection leaving it half open.

I’m puzzled as to why adding an oscilloscope prevents the issue from happening. Maybe some noise is getting added to the line that is getting picked up as characters keeping the connection alive.

Are you able to modify the strategy to close the comm handle when you are not going to be using it for a while?

Another thing you may want to check and change is in the modbus subroutine, open the block called ‘Open’, it may look like this:

if (GetNumCharsWaiting(chCommHandle) < 0) then
    nStatus = OpenOutgoingCommunication(chCommHandle);
else
     nStatus = 0;
endif

I recommend changing it to this, as it is more robust:

if (GetNumCharsWaiting(chCommHandle) < 0 or not IsCommunicationOpen(chCommHandle)) then
  nStatus = OpenOutgoingCommunication(chCommHandle);
else
  ClearCommunicationReceiveBuffer(chCommHandle);
  nStatus = 0;
endif
1 Like

Okay I will do that. I also added a counter to my loop that looks for open chambers to communicate with. If it cycles all the way through and none are open, it closes the com handle until one is opened. I will update this post again if it still happens. Thanks for your help Philip, Opto Awesome to the rescue.