I guess a PLC is programmed and run by a micro-controller at its centre. But normally we use C language to program micro-controllers.

When we program PLC, is the ladder logic first converted to C or compiled directly by a special compiler?


2 Answers 2


There are various methods used by different manufacturers. The oldest kind of ladder was consisted by an array of gate logic already running as main program in the MCU. With a ladder program you just enabled or disabled the elements (contacts) and with regard on their position AND or OR operations were executed. This had limitations.

The newer approach is to make a intermediary pseudo program, similar as assembler (Instruction list). The main program in MCU runs an interpreter, each rung is evaluated and executed at once. With this kind, you have the possibility to have more elements of different types and a rung not limited to few elements. The downside is the slow execution due to interpreter. A good thing is that the program does not need to be compiled, it can be input at the PLC itself (small LCD), a program can be edited online with changes, it can be also uploaded from PLC in original aspect.

The latest kind of PLC uses a compiler to generate code. The program can't be uploaded from PLC as original if the source wasn't downloaded into PLC, also. The compiler makes an intermediate results, that are used for online monitoring. If the generated block is tested and it doesn't need to be monitored any further, the compiler can be set to generate the optimised code, you loose the ability to monitor it, but it executes fast. The downside is a complex copy/move program memory if the program is changed, also it is almost impossible to make a big change of program without re initialising the static memory (RAM).


Many modern PLCs have (sometimes multicore) Intel or AMD processors with 64bit. Micro-controllers are rarely used nowadays for high-performance PLCs. These PLCs have their own operating system, mostly based on Linux, or for example Beckhoff is running on Windows Embedded. Ladder logic can be compiled directly, but I don't know who is doing it and who not.

Check this link: https://www.quora.com/How-is-PLC-ladder-logic-converted-to-machine-code-Does-it-really-convert-into-machine-language


Some manufacturers have their own processors, not sure, but Siemens I think too. Modern PLCs are more like (real-time) computers than the classic PLCs from the 90s.

  • \$\begingroup\$ Could I have some modern example products please which use Intel / AMD 64-bit processors? I repair PLC equipment for a living, and have not seen one of these yet. \$\endgroup\$
    – rdtsc
    Commented Mar 31, 2020 at 12:03
  • \$\begingroup\$ B&R uses Intel Atom in their X20 and Intel i5 in their IPC. Beckhoff uses Intel too, but I guess you're right, it's 32 bit. \$\endgroup\$ Commented Mar 31, 2020 at 13:12
  • \$\begingroup\$ SIEMENS WinAC runs on Windows machines for decades. Also Beckhoff, Wago and every Software-PLC do so \$\endgroup\$
    – Findus
    Commented Mar 31, 2020 at 14:50
  • 1
    \$\begingroup\$ SIEMENS uses its own ASIC with its own assembler like (AWL) instruction set. In 300/400 series KOP and FUP were translated into AWL before storing on memory. \$\endgroup\$
    – Findus
    Commented Mar 31, 2020 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.