Skip to Content
Skip to content
Engineering knowledge base / PLC and I/O

PLC selection, IEC 61131-3 languages and I/O wiring

The right PLC is chosen from the I/O count, the axis count, the cycle time and the communication it must carry. Most problems in the field, though, come from basics: PNP/NPN mismatches, retained data and scan-time overruns.

  • 5 questions answered
  • Basics
  • Commissioning
  • Troubleshooting

Basics 01

Which PLC should I choose for my machine?

Choose a PLC with four questions: how many digital and analog I/O are needed, how many servo axes and which kind of motion (independent, synchronised, interpolated, CNC), what cycle time is targeted, and which networks it must carry (EtherCAT, CANopen, Modbus, Ethernet). Leave headroom for axes and I/O added later.

  • From single-axis motion to robotics and CNC: the MAT-LC CPU family
  • EtherCAT slave coupler for remote I/O
PLC & controllers

Basics 02

Which IEC 61131-3 language should I use: LD, ST, FBD or SFC?

They can all live in the same project, and each suits a different job. Ladder (LD) for discrete interlock logic that maintenance staff can read, Structured Text (ST) for calculation, data handling and motion code, FBD for signal flow and control loops, and SFC for machine sequences that advance step by step. Instruction List (IL) was deprecated in the third edition of the standard.

CODESYS

Commissioning 03

What is the difference between PNP and NPN sensors, and how do I wire them to a PLC input?

A PNP (sourcing) sensor puts +24 V on its output when active, so it goes to a sinking PLC input whose common is 0 V. An NPN (sinking) sensor pulls its output to 0 V when active and goes to a sourcing input whose common is +24 V. With a mismatch, the input never switches on, or never switches off.

  • Our inductive, photoelectric and cylinder sensors come in PNP and NPN versions
  • Standardising on one type per machine avoids spare-part mix-ups
Sensors

Basics 04

Is a normal PLC input enough for an encoder or fast counting?

Usually not. Standard digital inputs are read and filtered in the PLC scan cycle, so pulses shorter than the scan are missed. To read an encoder, count fast or generate pulses, use a high-speed counter (HSC) or pulse module; these count in hardware, independently of the scan.

MAT-LC I/O modules

Troubleshooting 05

The PLC stops with a watchdog error. What causes it?

A watchdog says a task did not finish within the time it was given. Typical causes: a loop over many elements, an endless WHILE loop, file or network work done inside the task, or newly added code pushing the task past its budget. Look at the maximum cycle time in the task monitor and move heavy work to a lower-priority task.

CODESYS task configuration

Related pages

Didn't find your answer?

Tell the engineering team about your application

Drive code, motor, controller and the alarm code you see: with those we reach the right answer faster.

Start Product Selection Filter, compare, add to basket