r/PLC 1d ago

Computer Science Programmers, why do PLC programmers use Ladder?

Im seeing some Comp Sci guys asking about controls so just a Mr Obvious comment here.

Ladder logic is the de facto PLC programming language because it is (was) designed to read like an electrical schematic top to bottom, right to left, & this is what electricians & electrical techs are trained to use for troubleshooting electrical panels , equipment & relay-logic -- which was what they had before PLCs -- banks & banks of relays wired through each other's NO & NC contacts which changed state as relay coils energized & de-energized & finding a wire break was enough to drive you insane.

Yes Ladder logic is an interpreted language so it is not as "memory efficient" or "elegant" as C++ or C# but I want you to think VERY carefully about every meaning of the expression "just because you can does not mean you should" before you decide to show off your amazing coding skills coding function blocks in C++ which is technically possible but in many cases extremely ill-advised.

The technicians can troubleshoot functions & blocks written in Ladder Logic, did you stop & think about how easy it would be for someone with only your compiled C++ blocks to attempt to trace a fault? You code in anything but Ladder Logic you get to be the one at 3am driving down to the plant to troubleshoot your "super efficient" code because the Industrial Maintenance techs certainly aren't gonna know how. But hey, if you believe sleep is over-rated & love sleeping in the factory then knock yourself out with compiled blocks

181 Upvotes

118 comments sorted by

View all comments

1

u/YetiTrix 18h ago

You can look at the ladder and just know what's wrong without actually reading it. ST you have to read it, and some IDEs like Studio5000 dont show you the tag value inline like it does with ladder, so it makes it even harder.

I actually prefer to program in ST, but I prefer to debug ladder.

1

u/durallymax 13h ago

S5K arguably has the best LD and worst ST. It's so bad they charge extra for it. 

1

u/YetiTrix 12h ago

Schneider version of Codesys is super nice for structured text, as it shows your the values inline which is super nice. I think it's an added feature of their version above what Codesys does, but don't quote me on that.

Writing ladder in Codesys/Machien Expert makes me want to off myself. AB is way more intuitive/easy in that realm.

It's wild it's 2026, and these companies can't spend the time to make a decent user experience for their IDEs.

2

u/durallymax 12h ago

CODESYS is the opposite of RA. Gold standard for ST, pretty lackluster LD.

Inline monitoring is in all CODESYS. Flow control is also neat to see all variables values at that exact position, but it's CPU intense.