Here is some information about monitoring the driver task. This is not an official Indusoft document, but it is intended that you will find the information to be useful and accurate.

If you have only one driver configured in the project, and you need to stop and then restart the driver without shutting down the project , you can use the functions EndTask() and StartTask()

Ex EndTask("Driver<DriverName>")

StartTask("Driver")

Note that you cannot stop the overall driver task with the EndTask() function, since EndTask(“Driver”) is not allowed. A driver name must always be included when using this function in conjunction with the driver task.

You can execute StartTask(“Driver”) to start all configured drivers not currently running, so this method is ok to use if you only have one driver configured. It may not be a suitable choice, however, if more than one driver is configured.

If you want to start a single driver without affecting other configured drivers (ie without restarting currently running drivers or starting other currently stopped drivers), you need to use the WinExec() function.

This form will run from the database spy for quick tests, or from Built-In language structures (Math,scheduler,etc) in

an IWS application.

WinExec(GetProductPath()+"Bin\Studio Manager.exe "+ Asc2Str(34) + GetProductPath() + "Bin\Driver.dll" +

Asc2Str(34) +"ABTCP")

This form will run from a VBScript

$WinExec($GetProductPath()+"Bin\Studio Manager.exe "+ $Asc2Str(34) + $GetProductPath() + "Bin\Driver.dll" +

$Asc2Str(34) +"ABTCP")

This form will also run from VBScript, using a pair of double quote characters in place of the $Asc2Str(34) functions

in the concatenation.

$WinExec($GetProductPath() & "Bin\Studio Manager.exe """ & $GetProductPath() & "Bin\Driver.dll""" & "ABTCP")

Note that there is a space between the file extension exe and the double quote. Note also that the return value of the

function GetProductPath() already ends with a backslash, so you don’t need it in the strings.

If a driver is stopping, you can monitor this in the following manner:

The Scheduler configuration below is implemented to launch a script by writing the value 1 to the tag Driver Restart, which

is configured in the Execution field of a script that contains the following two lines:

The first line resets the DriverRestart tag to 0, so the script only runs one time when launched, and the second restarts a driver that has stopped.

The Scheduler configuration ensures that script will not be launched unless the specified driver has stopped running.

********************************************************************

If the driver task isn't stopping, but you want to monitor the Read Status of a particular driver, then you can set up the

scheduler to launch a script that stops a particular driver with EndTask() and then restarts it with WinExec(), if the

Read Status tag has been set to 0 for longer than n seconds:

This script is launched if the Read Status tag (RdStat) on the driver sheet is non-zero for longer than 5 seconds.

The first line resets the StopStartDriver tag so the script only runs once, and the remaining lines stop the specified driver and

then restart it. The wait may need to be adjusted to allow time for the driver to be stopped before it is restarted.