Professional Documents
Culture Documents
Introduction
A PLC (Programmable Logic Controller) is an industrial computer used for automation
of electromechanical processes, such as control of machinery on factory assembly lines,
amusement rides, or light fixtures. PLCs are expected to work flawlessly for years in
industrial environments that are hazardous to the very microelectronic components that
give modern PLCs their excellent flexibility and precision.
Prior to PLCs, many of these control tasks were solved with contactor or relay controls.
This is often referred to as hardwired control. Circuit diagrams had to be designed,
electrical components specified and installed, and wiring lists created. Electricians would
then wire the components necessary to perform a specific task. If an error was made the
wires had to be reconnected correctly. A change in function or system expansion required
extensive component changes and rewiring.
Objectives
This experiment aims to:
1- Learn the basics of ladder logic programming.
2- Familiarize the students with SIMATIC S7 software to program Siemens S7-400
PLC.
3- Implement different logic functions using PLC.
4- Understand the function of each Siemens S7-400 PLC modules.
Theory
The last figure shows a switch connected to the input I0.0 in the digital input module,
and an LED connected to the output Q0.0 in the output module.
Ladder Logic Programming
Figure 3 shows electrical continuity, when SW1 is closed, the current will flow from L-1
to L-2 and energize the load.
Even though PLC ladder logic was modeled after the conventional relay ladder, there is
no electrical continuity in PLC ladder logic. PLC ladder rungs should have logical
continuity in order for the output to be energized. PLC ladder program uses familiar
terms like “rungs”, “normally open” and “normally closed” contacts, as illustrated in
table 2.
Table 2: Fundamental contacts and coils instructions of PLC ladder logic programming
In a ladder logic program, there is no physical conductor that carries the input signal
through to the output. Each rung in the ladder diagram is a program statement. This
program statement consists of a condition or sometimes conditions, along with some type
of action.
Inputs are the conditions, and the action, or output, is the result of the conditions. As in
case of physical wiring hardware devices connected in series or parallel, PLC also
combines ladder program instructions in series or parallel. However, rather than working
in series or parallel, the PLC combines instructions logically using logic operators like:
AND, OR, and NOT. These operators are used to combine the instructions on a PLC rung
to make the outcome of each rung either true or false.
1. AND-logic function:
A series circuit of two switches can be regarded as AND logic function. In figure
4, both switches (SW1 AND SW2) must be closed to have electrical continuity to
energize the output (Light-1). Hence the keyword here is AND.
Figure 4: AND-logic function
The circuit shown in figure 5 represents a schematic ladder logic rung for the
circuit shown in figure 4. When switch 1 and switch 2 are closed the output coil
will be energized.
The circuit shown in figure 7 represents a schematic ladder logic rung for the
circuit shown in figure 6. If switch 1 or switch 2 is closed the output coil will be
energized.
Figure 7: Ladder logic diagram for OR function
3. The PARALLEL NOT logic function:
Figure 8 shows ladder diagram for the parallel NOT logic function and its truth
table is illustrated in table 3.
The signal state of output Q4.0 is "1" if one of the following conditions exists:
• The signal state is "1" at inputs I0.0 and I0.1
• Or the signal state is "0" at input I0.2.
If the RLO is "0", the signal state of output Q4.0 remains unchanged.
Description: ---( R )--- (Reset Coil) is executed only if the RLO of the preceding
instructions is "1" (power flows to the coil). If power flows to the coil (RLO is "1"), the
specified <address> of the element is reset to "0". A RLO of "0" (no power flow to the
coil) has no effect and the state of the element’s specified address remains unchanged.
The <address> may also be a timer (T no.) whose timer value is reset to "0" or a counter
(C no.) whose counter value is reset to "0".
The following example illustrates the operation of reset instruction, see figure 12:
Figure 12: Reset coil instruction example
The signal state of output Q4.0 is reset to "0" if one of the following conditions exists:
• The signal state is "1" at inputs I0.0 and I0.1
• Or the signal state is "0" at input I0.2.
If the RLO is "0", the signal state of output Q4.0 remains unchanged.
The signal state of timer T1 is only reset if:
• the signal state is "1" at input I0.3.
The signal state of counter C1 is only reset if:
• the signal state is "1" at input I0.4..
• Positive RLO Edge Detection
• Figure 13 shows the symbol of Positive RLO Edge Detection instruction.
Description: ---( P )--- (Positive RLO Edge Detection) detects a signal change in the
address from "0" to "1" and displays it as RLO = "1" after the instruction. The current
signal state in the RLO is compared with the signal state of the address, the edge memory
bit. If the signal state of the address is "0" and the RLO was "1" before the instruction,
the RLO will be "1" (pulse) after this instruction, and "0" in all other cases. The RLO
prior to the instruction is stored in the address.
Table 4 illustrates the function of each parameter of Positive RLO Edge Detection:
Table 4: Positive RLO edge detection parameters
Parameter Data type Description
<adress> Bool Edge memory bit, storing the previous signal state of RLO
The following example illustrates the operation of Positive RLO Edge Detection, see
figure 14:
• The edge memory bit M0.0 saves the old RLO state. When there is a signal
change at the RLO from "0" to "1", the program jumps to label CAS1.
• Negative RLO Edge Detection
• Figure 15 shows the symbol of Negative RLO Edge Detection instruction.
<adress> Bool Edge memory bit, storing the previous signal state of RLO
The following example illustrates the operation of Negative RLO Edge Detection,
see figure 16:
Figure 16: Negative RLO Edge Detection Example
The edge memory bit M0.0 saves the old RLO state. When there is a signal change at
the RLO from "1" to "0", the program jumps to label CAS1.