Command for Re-Enable Communications to I/O Units in PAC Control

I’m trying to write a command to re-enable my I/O units that become disabled for unknown reasons. That way I don’t have to manually open the I/O units folder, and change the status from “disabled” to “enabled” for the individual controllers (image).
Screenshot 2022-11-08 112801

Currently, my script will stop/start the strategy but that is too aggressive and requires the machine to be down.
Here is what I have:

sTransmitBuffer = “_END _RUN” + Chr(13);

//Repeat the following for each controller to restart.
SetCommunicationHandleValue(“tcp:”, comm); //put the controller to restart IP address in here
status = OpenOutgoingCommunication(comm);
status = TransmitReceiveString(sTransmitBuffer, comm, sReceiveBuffer); //sReceiveBuffer will have a couple nulls in it
status = CloseCommunication(comm);


Most start out using the Opto 22 ‘official’ I/O enabler chart, it does exactly what you are asking:

When you unzip it you will find a doc showing how to set it up and use it.
Its well used and loved since it does the work in a really smooth way - ie does not just bash at the I/O but has a back off timer.
It also logs errors and re-tries to the PAC Terminal / controller error que.

Perhaps this is all you need, so give it a go and if you are looking for ‘more’ or slightly different use case, just ask in this thread and we can brainstorm a bit.

1 Like

Thanks! I will give this a shot.

Here is something real simple that captures if an IO went off line and tries to enable 2 times before it would pop a message in PAC Display and allow the operator to retry. This uses the global instruction Enable Communication to All I/O Units and then waits 5 seconds before attempting again since the controller will not be very responsive during this execution. I have been using this global instruction for many years now without any issues and it does always work as long as there are no hardware issues with the IO. (6.9 KB)

1 Like