PLCskilltree

๐Ÿ”ท PROGRAM STRUCTURE > Programming Language ๐Ÿ”ท

I've been meaning to write something about this topic for a long time. Especially now where there's a lot of talk out there on programming languages, what AI can do for your logic in the future ๐Ÿค–, how high-level programming languages like C++ and others could fit into the mix etc...

There's definitely been some entertaining content ๐Ÿ’ฌout there from both the old-school PLC folks and the new up-and-coming ๐Ÿ˜€.

Although I enjoy reading most of those posts (I'm always ready to learn new things ๐Ÿง‘โ€๐ŸŽ“), I think they often overlook one important point.

You see, a real-life application ๐Ÿญ e.g. a production line, a processing plant or a stand-alone machine - isn't just inputs, outputs, global and local data, and a bunch of logic ๐Ÿงฉ to connect them all together (in other words: the programming LANGUAGE).

If you zoom out ๐Ÿ” and look at the bigger picture ๐Ÿ–ผ๏ธ, a real-life system is really a collection of modules - smaller, logical, self-contained units ๐Ÿ“ฆ (you got it - the program STRUCTURE).


And if you did your homework right, those modules should be:
โœ… Scalable
โœ… Easy to troubleshoot
โœ… Simple to maintain
โœ… Straightforward to update



In my opinion, this is what separates the 1% of PLC programmers from the rest - the ability to create modular PLC software - not just being great at ladder, structured text or any other language out there.

I feel there is way too much focus on programming languages and nowhere near enough on how to structure an application properly. You could write flawless code in the โ€œperfectโ€ language, but if your structure sucks, no-one will have a nice time troubleshooting your PLC application๐Ÿ”ง (speaking of which - I'm in the middle of one such mess right now ๐Ÿ˜…).


So what should you actually do before diving into any programming language?
๐Ÿ‘‰ Break your application into smaller, manageable parts
๐Ÿ‘‰ Define the key sections of your application (general, equipment, safety, motion, library, global data, etc.)
๐Ÿ‘‰ Create clean, independent data structures for each module
๐Ÿ‘‰ Build reusable functions or function blocks for repeatable logic (or at least define them - the logic comes later)


And the best part? ๐Ÿ’กThese structuring principles apply regardless of the programming language you use. Your program structure is like LEGO bricks ๐Ÿงฑ - itโ€™s the framework you define to build your application. The programming language? Thatโ€™s what goes inside those bricks.


So next time you start a new PLC project, remember:
1๏ธโƒฃ structure first
2๏ธโƒฃ language second


I appreciate you making it to the end of this little rant of mine ๐Ÿ˜


Do you agree with me, or have some other opinions?
โฌ‡๏ธ Let me know in the comments below โฌ‡๏ธ


Stay structured!
-Hans

PS. If you want get structured in TIA Portal, then grab my free guide right here ๐Ÿ‘‰www.plcskilltree.com/free-guide-optin

Youโ€™ll learn 5 simple steps to drastically improve the structure of your PLC applications in TIA Portal ๐Ÿ’ช

2 months ago (edited) | [YT] | 9



@promiseenyinnaya6346

Exactly agree. People overlook structure snd it's crazy. The other day i was looking at a program from a processing line on Kostac PP and i was asked to convert to Siemens TIA portal. It look a long while for me to understand the guys code because it almost 300+ lines of code was in a single POU. And it was scattered. Imagine starting the initial stage with the first scan bit on rung 0 then going down to rung 232 to actually define the code in that stage, very crazy work. I just had to scroll up and down the POU. Program structure is very important as tou said sir. Thank you

2 months ago | 1

@KS_Automation

You are right

2 months ago | 1

@temirkhanamanbaev42

I am agreed with you

2 months ago | 0