IO.SetConfigurationParameters

<< Click to Display Table of Contents >>

 

IO.SetConfigurationParameters

Type of Tag

Block Tag

Type of Access

Read-Only

B1 Parameter

-1 (minus one)

B2 Parameter

0 (zero)

B3 Parameter

0 (zero)

B4 Parameter

3 (three)

Size Property

2 (two)

ParamItem Property

IO.SetConfigurationParameters

 

Use this Tag to change any property of a Driver's configuration dialog box at run time.

This Tag works only while a Driver is in Offline mode. To start a Driver in Offline mode, select the Start driver OFFLINE option on the Driver's configuration dialog box. Users can write to a PLC Tag or to a Block Tag containing the parameters to change. Writing individual Block Elements is not supported, the whole Block must be written at once.

In Elipse SCADA, users must use a Block Tag. Every parameter to configure uses two Block Elements. For example, if users want to configure three parameters, then the size of the Block must be 6 (3 × 2). The first Element is the property's name, as a String, and the second Element is the property's value, according to the next example.

// 'Block' must be a Block Tag with automatic reading,
// scan reading, and automatic writing disabled.
// Configure all parameters
Block.element001 = "IO.Type" // Parameter 1
Block.element002 = "Serial"
Block.element003 = "IO.Serial.Port" // Parameter 2
Block.element004 = 1
Block.element005 = "IO.Serial.BaudRate" // Parameter 3
Block.element006 = 19200
// Writes the whole Block
Block.Write()

 

When using E3, the ability to create arrays at run time allows using an I/O Tag as well as a Block Tag. Users can use Driver's Write method to send all parameters to the Driver, without creating a Tag, according to the next example.

Dim arr(6)
' Configure all array elements
arr(1) = "IO.Type"
arr(2) = "Serial"
arr(3) = "IO.Serial.Port"
arr(4) = 1
arr(5) = "IO.Serial.BaudRate"
arr(6) = 19200
' There are two methods to send parameters
' Method 1: Using an I/O Tag
tag.WriteEx arr
' Method 2: Without using a Tag
Driver.Write -1, 0, 0, 3, arr

 

A variation of the previous example uses a bidimensional array.

Dim arr(10)
' Configure all array elements. Notice the array was resized
' to 10 elements. Empty array elements are ignored by a Driver
arr(1) = Array("IO.Type", "Serial")
arr(2) = Array("IO.Serial.Port", 1)
arr(3) = Array("IO.Serial.BaudRate", 19200)
Driver.Write -1, 0, 0, 3, arr

 

A Driver does not validate parameter names or passed values, therefore be careful when writing parameters and values. The Write method fails if the configuration array is incorrectly created. Users can check Driver's log or use the writeStatus parameter of the WriteEx method to find out the exact cause of the error.

Dim arr(10), strError
arr(1) = Array("IO.Type", "Serial")
arr(2) = Array("IO.Serial.Port", 1)
arr(3) = Array("IO.Serial.BaudRate", 19200)
If Not Driver.WriteEx -1, 0, 0, 3, arr, , , strError Then
  MsgBox "Failed configuring Driver parameters: " + strError
End If

Was this page useful?