Changes in the script userPara.ctl

This script contains the actual programming for the configuration panel. You need to call your driver at specific points in the script, pass the parameters for the address etc. and write the necessary scripts.

You must copy the script <wincc_oa_path>/scripts/userPara.ctl into the directory <proj_path>/scripts and modify it there. Any later changes for the new drivers must also be made in the project directory.

Add a new "case" option to the userPara.ctl script in the directory <proj_path>/scripts at the following places:

  • upDpGetAddress (for reading the values of the data points)

  • upDpSetAddress (for setting the values of the data points)

  • upWritePanelAllAddressAttributes (writes the attributes from data point configs to the panel)

  • upReadPanelAllAddressAttributes (reads the attributes from the panel and writes them to data point configs)

Then you must group all your commands together and write them at these points in the script. Your panel address_newdrv1.pnl also needs to be adapted to your requirements, i.e. text fields provided for the attributes of the _address config. These fields of the _address attributes are read by the script and written to the data points, or conversely, the attributes are read and written into the panel.

In these instructions the "case" option of the example script is used in each script location.

This example corresponds to the Simulator driver, and can be configured afterwards as "New driver 1".

To insert your script in the functions

  1. Copy the script <wincc_oa_path>/scripts/userPara.ctl into the directory <proj_path>/scripts/userPara.ctl

  2. Open the script userPara.ctl in the directory <proj_path>/scripts

  3. Go to the following location in the script under the function upDpGetAddress

/* Example

 case "tstdrv1": 
 dpGet(dpe+":"+config+".._active",active,
 dpe+":"+config+".._reference",reference,
 dpe+":"+config+".._subindex",subindex,
 dpe+":"+config+".._mode",mode,
 dpe+":"+config+".._reply",reply,
 dpe+":"+config+".._datatype",datatype, 
 dpe+":"+config+".._drv_ident",drv_ident, 
 dpe+":_distrib.._driver",driver);
 dpc[1]=reference; 
 dpc[2]=subindex;
 dpc[3]=mode;
 dpc[6]=reply; 
 dpc[7]=datatype; 
 dpc[8]=drv_ident;
 if (driver<1) driver=1; 
 dpc[9]=driver; 
 dpc[12]=active; 
 break;
 ....
  1. Select the block and insert this section of the script above /* Example.

  2. Remove the comment character from the new block

  3. Change the name next to "case" to

case "newdrv1"

  1. Go to the next function "upDpSetAddress" and to the example case "tstdrv1"

  2. Copy the section of script again as described above.

  3. Go to the functions "upWritePanelAllAddressAttributes" and "upReadPanelAllAddressAttributes" respectively and copy the example scripts.

  4. Save the script.

Now you have created those new sections of script that you need to program for new drivers.

This script makes the fields in the example panel for the address string (reference), the driver numbers (driver), the subindex (subindex), the check box, the status of the address (active), the data type (transformation type), the time-out (reply) and the direction (mode), readable and writable.

Which fields and sections are specifically needed depends on the drivers. The transmission direction in particular is sometimes linked to additional fields and the associated scripts.

Make sure that you only use the global variables needed by the driver concerned, and that you have always defined the same number of driver elements (e.g. dyn_strings, cases etc.).

The following global variables are available:

  • anytype dpc;

  • dpc[1]=reference (Address string for the driver)

  • dpc[2]=subindex (for the subindex of the driver)

  • dpc[3]=mode (mode, direction - input/output)

  • dpc[4]=start (for the start time)

  • dpc[5]=interval (for the interval)

  • dpc[6]=reply (for the response time, time-out)

  • dpc[7]=datatype (for the transfer scheme)

  • dpc[8]=drv_ident (driver name)

  • dpc[9]=driver (driver number)

  • dpc[10] = reserved for special usage

  • dpc[11]=poll_group (Poll group)

To view the "finished" panels go to "Working with the new driver". Peripheral addresses can now be configured conveniently. The panel is not designed for configuring special structures; further changes need to be made to the panel to do this conveniently (e.g. for an OPC client).