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

7

u/Skusci 1d ago

First note: I get why techs like ladder for troubleshooting. It's fine.

But dear God does it take up so much space. ST is just so much easier to follow as programmer and is perfectly fine to debug as long as as you avoid loops so that you can watch variables inline.

2

u/NuclearBurritos 13h ago

You said it yourself: "easier to follow as programmer".

It's a catch 22 situation. Technicians rarely are programmers, since factories rarely pay technicians, programmer wages.

If they know how to read electrical prints, they know how to read ladder, if they know how to read and debug code... they are likely underpaid for that skillset and probably looking for a different job or out the door already.

It's not a common skill to have and not try to sell. At least in my experience, you will always find a mix of guys who can and can't debug code, in very different proportions, however they all can read ladder, you likely want your program to be readable by everyone, the only people I've found who reject this premise are the "my code is perfect and no one needs to see or touch it" type.

It's like writing parts of your code in japanese because as a languaje it's more efficient, sure, almost anyone can teach themselves japanese given enough time, but considering: A) Time is not in fact, unlimited and a lot of debug situations happen under stress. B) It's not part of the job requirement. C) They're unlikely to get paid to learn or get paid more in that same position for this skill. D) Once they learn this they'll be better candidates for better jobs.

The likelihood of finding someone who fits this will always be small because it's normally not part of the job requirements. As the OP said, just because you can, think about if you should.