I’m happy to announce, that I’ve just completed my first course on PLC programming. It was really interesting to see how much it differs from C++ programming for example, as both the language used, both the possibilities for code organization differs greatly. For instance, ladder logic or more commonly LAD (one of the most widespread language for PLCs), is a graphical language, meaning, that instead of writing code in a text editor, one needs to pull in instructions onto a ladder-looking graph, which has a well defined and easily understandable execution pattern. Conditions, comparisons, etc go to the left side, while mutating instructions go the right side. This sort of organization makes it really easy to see what is going on and which code sections get executed, so it’s pretty neat. It was also really interesting to see, that the user created program gets executed just like on a microcontroller, namely in an infinite loop.
Apart from the visual difference, there are other differences as well, like that there are no higher level constructs/features such as classes, containers, loops, etc. though containers and loops could probably be emulated with smartly written logic. Because of this, one needs to find innovative ways to organize code into independent sections, which is not that dissimilar from what C programmers have to do, as there is a possibility to create separate “Data files”. These data files could be thought of as individual translation units, but it still differs from a C-style source file, as one has no possibility to call just sections of the data file, unless there is some specially written logic in it. If we also add that there is only a predefined set of instructions that one is able to use to create a program, one could probably conclude, that LAD programming is some sort of an amalgam of Assembly and C programming.
All in all, it was really neat to learn this new way of progamming, hopefully the next course (which I already have in store) will be equally interesting.
As always, thank for reading.
P.S.: All of the above written things were discussed from an Allen-Bradley perspective (this is what I became familiar with at the moment), so my observations might not apply universally in the PLC world.