Accessing the Values of System Variables
While running an application online, access diagnostic information from system variables for individual controllers, updated by the running code or simulation code. When running an application online, the cycle timing system variables are also available from the
Cycle Timing
dialog box, accessed from the Online
menu.System variables hold the values of information relating to cycle count, timing, kernel bindings, and controller information. Monitor system variables from the dictionary instances for resources. Read from and write to system variables. Available system variables are:
Variable name | Type | Read/Write | Description |
---|---|---|---|
__SYSVA_CYCLECNT | DINT | Read | Cycle counter |
__SYSVA_CYCLEDATE | UDINT | Read | Timestamp of the beginning of the cycle in milliseconds |
__SYSVA_KVBPERR | BOOL | Read/Write | Kernel variable binding producing error (production error) |
__SYSVA_KVBCERR | BOOL | Read/Write | Kernel variable binding consuming error (consumption error) |
__SYSVA_RESNAME | STRING | Read | Resource name (max length=255) |
__SYSVA_SCANCNT | DINT | Read | Input scan counter |
__SYSVA_TCYCYCTIME | TIME | Read/Write | Programmed cycle time. The defined cycle time for the controller. |
__SYSVA_TCYCURRENT | TIME | Read | Current cycle time. The time spent with the virtual machine. |
__SYSVA_TCYMAXIMUM | TIME | Read | Maximum cycle time. The longest period of time used for a current cycle (__SYSVA_TCYCURRENT), since connecting to the controller. |
__SYSVA_TCYOVERFLOW | DINT | Read | Cycle overflow. The number of current cycles (__SYSVA_TCYCURRENT) that have exceeded the programmed cycle time. |
__SYSVA_RESMODE | SINT | Read | Resource execution mode. Possible modes are:
|
__SYSVA_CCEXEC | BOOL | Write | Execute one cycle when application is in cycle to cycle mode |
__SYSVA_TCYTRUECURRENT | TIME | Read | True cycle time. The real duration of a cycle. |
To access the values of system variables in design mode
- From a program organization unit (POU), right-click the required variable, and selectVariable Monitoring(or pressCtrl+I).
To access the values of system variables in online or simulation mode
- Create a spy list.
- Open theVariable Selectorfrom a language editor.
- Select theSystem Variablestab.
- Select all variables.
- Right-click and selectAdd to<name of created spy list>.
- Run the application online or simulate the application.
- Open the created spy list.
Provide Feedback