Writing the value of a device variable

The Variables tab provides the ability to Write the current value of device variables. You must have write access to change the value of a device variable.

To write the value of a device variable, follow these steps:

  1. From Workbench left pane, expand the node whose device's variables you want to write.
  2. Select Devices.
  3. From the right pane, select the Variables tab.
    The Variables tab appears as the right pane.
  4. From the appropriate device, select the plus sign to expand the device's internal structure and variables to locate the device variable whose value you want to write.
  5. Select the device variable, display its pop-up menu, and then select Write.

  6. Select the device variable, display its pop-up menu, and then select Write.
    For this example, an INT based device variable is selected.
    The Write window appears.

  7. Type the new value, and then select OK.
    The device driver writes the value to the device and, if successful, displays the new value in the Value column.

Writing multiple device variables at one time

Multiple device variable rows can be selected and written at one time by using the pop-up menu Write option or the Write button.
If non writable rows are selected, such as a Device row or a structure row, a warning messages is displayed and asks if you want to continue.

Care should be taken when writing multiple device variables of different data types.

Writing device variables as a different data type

The device and its variables shown in the example support the writing of device variables as a different data type. All devices do not support this function.

In the pop-up menu, you can also select Write as to have the supported alternative data types displayed. In this example the data types are: INT2, INT4, FLOAT4 and STRING.

When you use the Write as function, the device driver writes the values of variables starting at the current variable address for the length implied by the selected data type.
For example, using Write as INT4 on device variable D[0] would write 2 2-byte WORDS. The variables written would be D[0] and D[1], each of which is a 2-byte INT2.

Understanding of the device's variable types (registers, tags, coils, inputs, and outputs are some examples of device specific terminology), the device's variables data types, and the device's variable addressing concepts is imperative when using the Read as and Write as functions of the Workbench.

Displaying integer results as hex

The Variables tab supports displaying integer values as hex values. This option is toggled on or off and applies to all devices variables' values.
When writing values, the value must be entered in decimal (base 10) format.