I had edited my response to your earlier question to cover this lightly. Here's some more detail for a basic PLC.
Task execution order
Typically PLCs task execution order runs as follows:
- Read the inputs.
- Execute the logic.
- Write the outputs.
- Handle other tasks, etc.
The 'Read the inputs' and 'Write the outputs' stages are the 'mass I/O copying' stages. The reason the logic is executed this way is that it presents a consistent state for the inputs through the program and prevents output strobing during the program scan. It also means that updating of I/O can be handled as a background task.
Problem with direct input read
UP BUTTON MOTOR UP
X1 Y0
--| |---------+-------------( )-
UP BUTTON MOTOR DOWN
X1 Y1
--|/|---------+-------------( )-
In the above example if X1 were to turn off between the first read and the second read both MOTOR UP and DOWN outputs would be energised simultaneously. Normal practice is to read all the inputs into an internal register and the program looks at that rather than directly at the inputs. This gives consistent predictable behaviour of the code and avoids race conditions.
Problem with direct output write
UP BUTTON MOTOR UP
X1 Y0
--| |---------+-------------(L)-
UP LIMIT SW MOTOR UP
X2 Y0
--| |---------+-------------(U)-
This example might not be the best code but PLC coding allows it and it can prove to be a useful tool when used with skips / jumps. The first rung turns on MOTOR UP using a latching 'relay coil'. The second rung unlatches the coil when the UP LIMIT SW turns on. It should be clear that if X1, UP BUTTON, switch is held on that immediate output writes would cause Y0 to blink briefly on every scan. Writing to the internal output memory and copying the whole lot to the outputs when program execution is complete solves this problem as the state at the end of the logic scan is what gets written to the outputs.
Immediate read
Most PLCs allow an immediate read and write which can be useful to shorten the cycle time of a machine. Others allow a few inputs to be used as interrupts so that program execution can jump to a subroutine and execute immediately.