A digital input asks one question: is enough current flowing through its LED? The LED sits inside an optocoupler, which passes the signal to the CPU as light, so the field wiring is isolated from the CPU. The module puts a resistor in series with that LED, so a 24 V DC input is a small current path, and the field switch decides whether the path is complete. Addresses here are in IEC style: %I0.0 is an input bit, %Q0.0 an output bit, %M0.0 a memory bit. Some PLC families write them differently.
INPUT CURRENT OF A 24 V DC INPUT
Iin=RinVs−VF
Holds while the switch is closed and the input is a series resistor plus an LED. Vs is the supply (V), VF the LED drop (about 1.2 V), Rin the series resistor (Ω), Iin in A. With Rin=4.7kΩ, Iin≈4.9 mA. The input reads 1 when Iin exceeds the module's on-threshold.
Which way the current runs gives the two wiring styles. A group of inputs shares one return terminal, called the common. In a sinking input the module is the 0 V end: current flows from +24 V through the field device, into the input terminal, through the LED and resistor, and out of the common, which is tied to 0 V. In a sourcing input the module is the +24 V end: the common is tied to +24 V, and current flows in at the common, through the LED and resistor, out of the input terminal, through the field device, to 0 V. A three-wire sensor also takes its own supply from +24 V and 0 V.