Introduction
Registers and data tables help store and organize information inside a PLC so it can control machines and processes easily.
RegisterName: DataType DataTableName: - Register1: DataType - Register2: DataType
Timer1: INT Counter1: DINT
SettingsTable: - Speed: REAL - Mode: BOOL
PROGRAM Main VAR Counter: INT := 0; DataTable: ARRAY[1..3] OF INT := [10, 20, 30]; END_VAR // Increase counter Counter := Counter + 1; // Read from data table VAR Value: INT; END_VAR Value := DataTable[2]; // Output values // (In real PLC, use watch or output to HMI) END_PROGRAM
DataTable1 with 10 registers in a typical PLC program?DataTable1[3] after execution?DataTable1: ARRAY[1..5] OF INT := [10, 20, 30, 40, 50]; DataTable1[3] := DataTable1[2] + DataTable1[4];
Register1: INT; Register1 := 100 Register2 := 200;
Pass the test and this pattern moves unknown