Defining the PLC Symbols
Now that we’ve established a connection to the PLC, let's examine the symbols we’ll be working with in this book.
The MAIN
program in the TwinCAT project is defined as follows:
PROGRAM MAIN
VAR
nValue : DINT := 42;
fValue : LREAL := 3.14;
eValue : E_Value := E_Value.Winter;
arValue : ARRAY[0..2] OF LREAL := [273.15, 2.71, 9.80665];
stValue : ST_Value := (bValue := TRUE, sValue := 'Hello there!');
fbValue : FB_Value;
ipValue : I_Value := fbValue;
END_VAR
In this book, we’ll be interacting with a variety of symbols, each representing different data types and complexities, including:
nValue
: A basic integer type.fValue
: A floating-point value (LREAL).eValue
: An enumeration.arValue
: An array containing floating-point numbers (LREAL).stValue
: A structured type that we’ll define below.fbValue
: A function block that includes an RPC method and a property.ipValue
: An interface that includes an RPC method.