BASEstartm Open DAS
for Allen-Bradley Data Highwaytm
on Tru64tm UNIX
Installation and User's Guide


Previous Contents Index

3.2.2 Read and Write Variable Functions

Use the read variable and write variable functions to read data from and write data to a specific address in PLC memory.

Table 3-2 lists the variable types supported by this DAS.

Table 3-2 Read and Write Variable Types
Variable Type Address Type Supported
UNNAMED_VARIABLE NUMERIC No
  SYMBOLIC No
  UNCONSTRAINED Yes
NAMED_VARIABLE   Yes 1


1Named variables are not supported by the DAS, but they are used by BASEstar Open when accessing variables using the Device Manager Server. The BASEstar Open Device Manager Server converts named variables with an address type of UNCONSTRAINED to unnamed variables.

An UNNAMED_VARIABLE type describes a specific physical address on a VMD. This address has a predefined type based on the address. Variables of this type are an inherent part of the VMD architecture and are uniquely identified by their physical address.

An unnamed variable can be one of the following types:

A NAMED_VARIABLE type describes a variable on a PLC. Variables of this type are uniquely identified by their name.

Table 3-3 lists the read and write variable functions available through the BASEstar Open (CLI) and OMNI (API) interfaces.

Table 3-3 Read and Write Variable Interface Access
Interface Function Name
CLI GET VALUE UNNAMED_VARIABLE
  PUT VALUE UNNAMED_VARIABLE
API omni_get_value
  omni_get_value_a
  omni_put_value
  omni_put_value_a

Example 3-1 shows examples of creating unnamed variables using the CREATE UNNAMED_VARIABLE command.

Example 3-1 UNNAMED_VARIABLE CREATE Command

BSTR> CREATE UNNAMED_VARIABLE plc_2_15.p1 \
      -DATATYPE INTEGER_16 \
      -ADDRESS "200" \
      -ADDRTYPE UNCONSTRAINED
BSTR> CREATE UNNAMED_VARIABLE plc_3.p1 \
      -DATATYPE INTEGER_16 \
      -ADDRESS "$N5:20" \
      -ADDRTYPE UNCONSTRAINED
BSTR> CREATE UNNAMED_VARIABLE plc_5_40.p1 \
      -DATATYPE BIT \
      -ADDRESS "$N7:30/1" \
      -ADDRTYPE UNCONSTRAINED
BSTR> CREATE ARRAY_DATATYPE WORD_ARRAY_10 \
      -DATATYPE INTEGER_16 \
      -SIZE 10
BSTR> CREATE UNNAMED_VARIABLE plc_5_40.p2 \
      -DATATYPE WORD_ARRAY_10 \
      -ADDRESS "$N7:30" \
      -ADDRTYPE UNCONSTRAINED
BSTR> CREATE STRUCTURE_DATATYPE PLC_5_COUNTER \
      -MEMBERS (CONTROL:INTEGER_16 PRE:INTEGER_16 ACC:INTEGER_16)
BSTR> CREATE UNNAMED_VARIABLE plc_5_40.p3 \
      -DATATYPE PLC_5_COUNTER \
      -ADDRESS "$C5:4" \
      -ADDRTYPE UNCONSTRAINED
BSTR> CREATE UNNAMED_VARIABLE slc_5_04.p1 \
      -DATATYPE INTEGER_16 \
      -ADDRESS "$N7:0" \
      -ADDRTYPE UNCONSTRAINED

Example 3-2 shows the information displayed when you enter the GET VALUE UNNAMED_VARIABLE command.

Example 3-2 UNNAMED_VARIABLE GET VALUE Output

BSTR> GET VALUE UNNAMED_VARIABLE plc_5_40.p1
20
BSTR> GET VALUE UNNAMED_VARIABLE plc_5_40.p2
array[10] of INTEGER_16 
  [ 0]: 0 
  [ 1]: 0 
  [ 2]: 0 
  [ 3]: 0 
  [ 4]: 0 
  [ 5]: 0 
  [ 6]: 0 
  [ 7]: 0 
  [ 8]: 0 
  [ 9]: 0
BSTR> GET VALUE UNNAMED_VARIABLE plc_5_40.p3
structure PLC_5_COUNTER 
{ 
  CONTROL: 0 
  PRE: 0 
  ACC: 0 
}

Example 3-3 shows the information displayed when you enter the PUT VALUE UNNAMED_VARIABLE command.

Example 3-3 UNNAMED_VARIABLE PUT VALUE Output

BSTR> PUT VALUE UNNAMED_VARIABLE plc_5_40.p1
(Bit) : 1
BSTR> PUT VALUE UNNAMED_VARIABLE plc_5_40.p2
array[10] of INTEGER_16 
  [ 0]: (Integer 16) : 1
  [ 1]: (Integer 16) : 2
  [ 2]: (Integer 16) : 3
  [ 3]: (Integer 16) : 4
  [ 4]: (Integer 16) : 5
  [ 5]: (Integer 16) : 6
  [ 6]: (Integer 16) : 7
  [ 7]: (Integer 16) : 8
  [ 8]: (Integer 16) : 9
  [ 9]: (Integer 16) : 10


Previous Next Contents Index