Now that we've seen how registers work, let's process a program like plc's do to enhance our understanding of how the program gets scanned.
Let's consider the following application:
We are controlling lubricating oil being dispensed from a tank.
This is possible by using two sensors.We put one near the bottom
and one near the top, as shown in the picture below.

Here, we want the fill motor to pump lubricating oil into the
tank until the high level sensor turns on. At that point we want
to turn off the motor until the level falls below the low level
sensor. Then we should turn on the fill motor and repeat the
process.
Here we have a need for 3 I/O(i.e. Inputs/Outputs). 2 are inputs(the
sensors) and 1 is an output(the fill motor). Both of our inputs
will be NC(normally closed) fiber-optic level sensors. When they
are NOT immersed in liquid they will
be ON. When they are immersed in
liquid they will be OFF.
We will give each input and output
device an address. This lets the plc know where they are physically
connected. The addresses are shown in the following tables:
| INPUTS | ADDRESS | OUTPUT | ADDRESS | INTERNAL UTILITY RELAY | ||
|---|---|---|---|---|---|---|
| Low | 0000 | Motor | 0500 | 1000 | ||
| High | 0001 |
