Using System Variables

Introduction

This section describes the steps required to program and to use system variables in SoMachine.

System variables are global in scope, and you can use them in all the Program Organization Units (POUs) of the application.

System variables do not need to be declared in the Global Variable List (GVL). They are automatically declared from the controller system library.

Using System Variables in a POU

SoMachine has an auto-completion feature. In a POU, start by entering the system variable structure name (PLC_R, PLC_W...) followed by a dot. The system variables appear in the Input Assistant. You can select the desired variable or enter the full name manually.

G-SE-0001950.1.gif-high.gif

 

 

NOTE: In the example above, after you type the structure name PLC_R., SoMachine offers a pop-up menu of possible component names/variables.

Example

The following example shows the use of some system variables:

VAR
   myCtr_Serial : DWORD;
   myCtr_ID : WORD;
   myCtr_FramesRx : UDINT;
END_VAR

myCtr_Serial := PLC_R.i_dwSerialNumber;
myCtr_ID := PLC_R.i_wVendorID;
myCtr_FramesRx := SERIAL_R[0].i_udiFramesReceivedOK;