-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PLCs for Beginners
By :

In previous chapters, we’ve declared variables just enough to limp through our examples. However, we have not explored their syntax in any real depth. At this point, you may have a rough idea of how to declare a variable but in this section, we’re going to do a deep dive into how to declare and use variables.
All files in CODESYS and similar systems have a special area where variables are declared. As you may have noticed, a file, such as the PLC_PRG
file, is split in two. The bottom section is where the program’s logic is declared, as we have seen, while the top section is used to define variables.
Any time you create a file, the top section will always have the following lines of code in it by default:
VAR END_VAR
This is a special block of code, as this block of code is where all the variables for that particular file will be declared.
On its own, this block of code...