Introduction
Variables store information that your PLC program can use and change while running.
VAR variable_name : data_type; END_VAR
VAR motorRunning : BOOL; END_VAR
VAR temperature : REAL; END_VAR
VAR itemCount : INT; END_VAR
VAR motorRunning : BOOL; temperature : REAL; itemCount : INT; END_VAR motorRunning := TRUE; temperature := 23.5; itemCount := 10; // Output values // (In real PLC, use monitoring or display blocks) // Here we simulate output with comments // motorRunning = TRUE // temperature = 23.5 // itemCount = 10
Counter in a PLC program?Speed after declaration?VAR
Speed : INT := 100;
END_VAR
VAR
Temperature INT;
END_VAR
Count as an integer starting at 0, and Status as a boolean starting as TRUE. Which is the correct declaration?Pass the test and this pattern moves unknown