Item reference syntax
- Last UpdatedSep 02, 2024
- 2 minute read
Use item references to access data stored in memory registers in connected devices, as well as to access standard system items in the Communication Driver itself.
This section only describes the item reference syntax and options for the CODESYS server. For more general information about item references, see "Manage device items" and "Item reference descriptions" in the Communication Drivers Pack Help.
Item references in this Communication Driver use the following syntax.
CODESYS V3.x
For all variables in a CODESYS V3.x device, use the following syntax:
<application name>.<object name>.<variable name>
The following syntax diagram shows all of the possible options:
application name.object name.variable name
Where,
application name: The name of the CODESYS application.
object name: The name of the program organization unit (POU), global variable list, or other programming object that contains the variable. For example, PLC_PRG.
variable name: The name of the variable.
CODESYS V2.x
For local and global variables in a CODESYS V2.x device, use the following syntax:
[object name].<variable name>
The following syntax diagram shows all of the possible options:
{ object name }.variable name
Where,
object name: The name of the program organization unit (POU), global variable list, or other programming object that contains the variable. For example, PLC_PRG. This is required only if it is a local variable.
variable name: The name of the variable.
Note: Even if it is a global variable without an object, you must include the period (.) before the variable name.
This Communication Driver supports all data types, but it cannot access specific parts of a variable. For example, it cannot read from or write to a single bit in an Integer variable. If you need that sort of functionality, modify your application to create more variables of the appropriate data types.
In order for this Communication Driver to communicate with the specified variables, the variables must be included as symbols in the CODESYS application. Use your application development software to make sure the symbols are included. The procedure to do this varies by device manufacturer and CODESYS version, but for an example of how to do it using the standard CODESYS V3.x software, see the appendix at the end of this document.