we understand how the PLC processes inputs, outputs, and the actual program we are almost ready to start writing a program. But first lets see how a relay actually works. After all, the main purpose of a plc is to replace “real-world” relays.
We can think of a relay as an electromagnetic switch. Apply a voltage to the coil and a magnetic field is generated. This magnetic field sucks the contacts of the relay in, causing them to make a connection. These contacts can be considered to be a switch. They allow current to flow between 2 points thereby closing the circuit.
Let’s consider the following example. Here we simply turn on a bell (Lunch time!) whenever a switch is closed. We have 3 real-world parts. A switch, a relay and a bell. Whenever the switch closes we apply a current to a bell causing it to sound.