Programmable Logic Controllers and Industrial Automation
Scan cycle and I/O
A PLC repeats three phases: read inputs into memory, solve the program, then write outputs. Scan time is the total of these phases, and it matters because an input pulse shorter than one scan can be missed. Discrete I/O is described by its switching behaviour relative to the common terminal: a sinking (NPN) input provides a path to the negative/common, while a sourcing (PNP) device supplies positive voltage to the input. Mixing sensor and card types is a classic field error. Analog modules convert a current or voltage signal (typically 4–20 mA) into raw counts with a resolution set by the module, and scaling instructions map those counts to engineering units.
Programming and networks
Ladder logic uses contacts, coils, timers, counters and comparison/math blocks; structured text and function blocks appear in more complex systems. Safety functions belong in a dedicated safety-rated controller or relay, never in the standard program alone. Networks include EtherNet/IP, Modbus TCP/RTU, Profibus and Profinet; each has baud rate, topology and termination rules. Grounding and shielding - one end of the shield for analog signals, proper bonding of panels - prevent noise problems that look like program bugs.
Traps
Assuming a PLC output can drive a large contactor coil directly (check the card rating and use an interposing relay); forgetting that retentive memory holds values through a power cycle; and expecting analog counts to map neatly (a 4 mA live zero means 0 counts may represent a fault, not zero percent).
Worked example
A 12-bit analog input (0–4095 counts) receives 4–20 mA for a 0–100 kPa transmitter. At 12 mA: fraction = (12 − 4) / 16 = 0.50, so counts ≈ 0.50 × 4095 = 2048, and the scaled value is 50 kPa.