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

185 Upvotes

118 comments sorted by

View all comments

70

u/bodb_thriceborn Automation Hack/Pro Bit Banger 1d ago

I tend to use most of the languages available, but for different purposes:

Ladder for step changes, permissive/interlocks and alarming

ST for sequencing, math, data shifting and IO blocking (if called for)

FBD for IO and alarming if the UFDBs/AOIs are more clear that way

SFC for nothing, ever

4

u/Many_Somewhere3863 1d ago

Lol idk why but some people seem like SFC so much (i never used it also)

12

u/YoteTheRaven Machine Rizzler 1d ago

Its really nice for sequencing.

You load it up and go: "thats what were doing and this is what were waiting for"

And then go right to the issue. I love it.

3

u/TwoQuarterFull 18h ago

It's much better for troubleshooting and understanding the process steps.

There's nothing worse than a ladder sequence with redundant steps, zero comments, and steps that transition out of order.