At the read phase the PLC copies every input into memory, the input image table, and the program reads those copies, not the terminals. A rung that switches an output writes into the output image table, which the output module takes whole at the update phase. So in a plain scan an input keeps one value all scan, and an output reaches its terminal once per scan.
Addresses here are IEC style: %I0.0 is an input bit, %Q0.0 an output bit and %M0.0 a memory bit; some PLC families write them differently. A ladder program is a list of rungs, each read left to right. Contacts test bits, in series as AND and in parallel as OR, and a coil writes the rung's result into its bit. A normally open (NO) contact passes when its bit is 1, a normally closed (NC) contact when it is 0.
Take a motor: start button (normally open) on %I0.0, contactor coil on %Q0.0, and a stop button wired normally closed on %I0.1, so that a broken wire acts like Stop. %I0.1 is then 1 until Stop is pressed, so the rung tests it with an NO contact. Contacts 1 and 2 are in parallel, in series with contact 3, driving coil 4. Contact 2 reads the coil's own bit and holds the motor on after Start is released: the seal-in.
START-STOP RUNG AS A BOOLEAN EQUATION
%Q0.0=(%I0.0+%Q0.0)⋅%I0.1
Holds when the rung runs once per scan. The %Q0.0 on the right is the coil's bit read as a contact: its value in the output image table, left there by the previous scan.
Each scan's old %Q0.0 is the previous scan's new value. Start is released in scan 3, yet the seal-in keeps the motor on. In scan 4 Stop is pressed, %I0.1 falls to 0 and the rung breaks.
A microcontroller board can run the same logic; a PLC differs in everything around it. Its isolated 24 V DC and 4-20 mA inputs and relay or transistor outputs are ready to wire, where a board's 3.3 V or 5 V pins need your own isolation and drivers. It is built for heat, vibration, electrical noise and a cabinet. It runs the same read, execute, write order every scan, and a watchdog timer faults the CPU if a scan overruns its set limit. It is programmed in ladder and other standard languages, and serviced by swapping modules.