NAME: SECTION: Date Performed: January 18, 2023 Date Submitted: January 22, 2023 EXPERIMENT 1 Introduction to PLC Programming using Ladder Logic Objectives: - To learn basic PLC program codes using Ladder Logic Mode of Programming. - Appreciate the ease of simulating PLC program codes by simply using the PC. Equipment: Computer Lab PC with Logo Soft Comfort V8.0(Demo) Introduction: After the previous discussion on PLC Fundamentals, this first experiment will be dealing with Introduction to PLC Programming. PLC programming will be based on Ladder Logic. The entire programming work will be done and simulated on PC using Logo Soft Comfort V8.0 (Software for the PLC by Siemens). The Basics of Ladder Logic PLC Programming using Ladder refers to creating a circuit program which looks more like a circuit diagram. The language of PLC ladder logic programs consists of a commonly used set of symbols that represent control components and instructions. Below are some of the basic symbols we will use. Symbols used in PLC Input Terminals Two of the most common programming symbols for the input terminals are the Make Contact or normally open (NO) contact and the Break Contact or normally closed contact shown in Fig.1-1. Normally Open (NO) or Normally Closed (NC) or Make Contact Break Contact Fig. 1-1. Commonly used Input Terminal Symbols Symbolically, power flows through these contacts when they are closed. The Make Contact becomes “true” or activated (logic 1) when closed. On the other hand, the Break Contact is “true” or activated when the contact is open (logic 0). For easier understanding, refer to the table below. Experiment 1 – Intro to PLC Programming Page | 1 Contact The contact is Voltage at Logic State at PLC Input PLC Input Activated Present 1 Not Activated Not Present 0 Activated Not Present 0 Not Activated Present 1 Symbols used in PLC Output terminals The most common symbols for PLC output terminals are the Outputs and the Inverted Outputs shown in Fig. 1-2. a) Output b) Inverted Output Fig. 1-2. Commonly used Output Terminal Symbols Outputs are energized when current flows to them. When a coil is energized, it causes a corresponding output device (lamp, motor, etc.) to turn ON by setting the status bit controlling the output to a 1. Inverted Outputs, as the name implies, represent an output terminal wherein the logic state seen by the device attached to it is inverted. (Some PLC vendors do not include this type of output terminal). Note: The same status bit at the output may be used to control the make and the break contacts elsewhere in the program (this is called latching or hold operation which will be seen later). Experiment 1 – Intro to PLC Programming Page | 2 The Box Boxes represent various instructions or functions that are executed when power flows to them. Typical box functions are timers, counters, and mathematical operations. This symbol (Fig. 1-3) will be utilized in the succeeding experiments. Fig. 1-3. Box Symbol Basic Rules in Ladder Logic The vertical line indicates the “power supply” for the control system. The logical “power flow” is visualized to move from left to right. Read the ladder diagram from top to bottom and from left to right. The contacts associated with coils, timers, counters, and other instructions must have the same numbering convention as their control device for easier trouble isolation. The operation of latching is used where a momentary start input signal latches the start signal into the “ON” condition, so that when the start input goes into the “OFF” condition, the start signal remains “ON”. The latching operation is also referred to as holding or maintaining a sealing contact. Example for this will be given in the next section. Constructing a Ladder Diagram Example 1. Based on Fig. 1-4a, the coil will be energized when there is a closed loop between the + and the – terminals of the battery. Obviously, the coil will be energized when SW1 and SW2 are closed. SW1 and SW2 are normally open switches. We can simulate this circuit with a ladder diagram. A ladder diagram consists of individual rungs or networks. Each rung must contain one or more inputs and one or more outputs. The first function on a rung must always be an input instruction and the last instruction should always be an output. In this example, we have recreated the actual circuit of Fig. 1-4a with a ladder diagram shown in Fig. 1-4b. Here we made use of the make contact and the Output instructions. The vertical lines represent the power supply. Experiment 1 – Intro to PLC Programming Page | 3 a) Circuit Diagram b) Ladder Equivalent Fig. 1-4. Simple Example #1 Example 2. Fig. 1-5a shows that the coil will be energized when either of the switches are closed. Fig 1-5b shows the equivalent ladder diagram. a) Circuit Diagram b) Ladder Diagram Fig. 1-5. Simple Example #2 First LOGO Program Programming ON-OFF Inputs to Produce ON-OFF Outputs This section deals with straight inputs and outputs. Subsequent expreriments discuss counters, timers, and other special functions. Example 1. As our first LOGO program, let us take a look at the simple lamp circuit illustrated in figure 1-6a. This is only for instructional purposes as a circuit this simple would not require a PLC. In this simple example the lamp is OFF when the switch is open and ON when the switch is closed. Fig 1-6b shows the PLC wiring to accomplish this task. A switch is wired to the input of the LOGO and an indicator light is wired to the output terminal. Experiment 1 – Intro to PLC Programming Page | 4 a) Circuit Diagram b) PLC Wiring Fig 1-6. Discrete Control of PLC The LOGO program code will be as follows: Shown below is Figure 1-7 which illustrates the sequence of events. A switch is wired to one of the PLC input module interface (say, I1). A lamp is wired to one of the PLC output module interface (say, Q1). The program code (ladder) is in the CPU. The CPU scans the inputs. When it finds the switch open, I1 receives a binary 0. This instructs Q1 to send a binary 0 to the output module, therefore the lamp is OFF. When the CPU detects that the switch is closed, I1 receives a binary 1. This instructs Q1 to send a binary 1 to the output module, thus, turning ON the lamp. Take note that the ladder elements are highlighted when activated. Experiment 1 – Intro to PLC Programming Page | 5 Fig 1-7. Sequence of Events Example 2. Latching or Holding Operation. To state it again, latching operation is that - the same status bit at the output may be used to control the make or the break contacts elsewhere in the program. This operation will be demonstrated by the Motor Starter example below. Figure 1-8 is an example of a motor start and stop circuit. The motor starter (actuator) is wired in series with a NO momentary start pushbutton, NC momentary stop pushbutton, and a NC contacts of an overload relay. Take note of how a NC and a NO momentary switch might be used in a control circuit. Pressing the Start button will energize the motor starter, thus making the motor run. This closes the associated contact, M. When the Start button is released a holding circuit exists through the M contact and will keep the motor running. The motor will run until the NC Stop button is depressed or the circuit breaker opens. Fig. 1-8 Motor Starter Conventional Control Circuit Experiment 1 – Intro to PLC Programming Page | 6 This task of activating the actuator and starting the motor can also be accomplished with a PLC as shown below. Fig. 1-9 Conversion of Conventional Control Circuit to PLC Below is the I/O Allocation table for this particular problem. (Allocation table is part of the solution and must be included in the subsequent exercises) I/O Allocation Table INPUT I1 DESCRIPTION NO Start momentary OUTPUT Q1 DESCRIPTION Motor pushbutton I2 NC Stop momentary pushbutton I3 NC overload relay The program code for this sample exercise is shown below. Experiment 1 – Intro to PLC Programming Page | 7 The PLC wiring is shown on Figure 1-10. A NO Start PB is wired to the PLC input I1, a NC Stop PB is wired to the PLC input I2, and a NC overload relay is connected to input I3. A motor starter is connected to output Q1 (Output). Q1 contact serves as a holding circuit. Fig. 1-10. LOGO Wiring for the Motor Starter When the Start pushbutton is depressed the CPU receives a logic 1 from input I1. This causes the I1 contact to close. At this point all three inputs I1, I2, and I3 are logic 1. The CPU sends a logic 1 to the output Q1. The motor starter is energized and the motor starts. At this point, contact Q1 is logic 1. When the Start pushbutton is released the CPU receives a logic 0 causing I1 contact to open. This will not stop the motor from running due to the holding function of contact Q1 which remains to be logic 1. The motor will continue to run until the Stop pushbutton is depressed. Input I2 will now be logic 0 causing contact I2 to open and the output Q1 to be logic 0. The motor will turn OFF. An overload will also cause the motor to stop. When the Stop pushbutton is released, I2 will again be logic 1, and the program is ready for the next time the Start pushbutton is pressed. PLC Software -LOGO Soft Comfort V8.0(Demo) LOGO Soft Comfort is available as a programming package for the PC. This software provides many features such as: Offline creation of circuit program by means of Ladder Diagram. Experiment 1 – Intro to PLC Programming Page | 8 Simulation of the circuit program on the PC. Generating and printing the circuit program. Saving a backup of the circuit program on other media. Easy configuration of program codes. Observe the following rules in performing the experiment on PLC programming: 1. Start by developing the circuit program on your PC. 2. Simulate the circuit program on your PC and verify its functions. 3. Ask you teacher to check the correctness of your programs. 4. Save a copy of your circuit program. EXERCISES Write the allocation table and develop a LOGO program for the following: 1. A fan is to be started and stopped from any of the three locations. Each location has a NO start and stop momentary PB (pushbutton). (Hint: Stops must be in series and Starts in parallel). I/O Allocation Table for Problem 1 INPUT I1 DESCRIPTION NO Start momentary OUTPUT DESCRIPTION Q1 Fan pushbutton I2 NO Start momentary pushbutton I3 NO Start momentary pushbutton I4 NC Stop momentary pushbutton I5 NC Stop momentary Experiment 1 – Intro to PLC Programming Page | 9 pushbutton I6 NC Stop momentary pushbutton Experiment 1 – Intro to PLC Programming Page | 10 2. A milling machine (M) and its lubricating pump (L) both have NO start/stop switch. L must be running before M can be started. Furthermore, if L is turned OFF, M must stop. I/O Allocation Table for Problem 2 INPUT I1 DESCRIPTION NO Start/Stop toggle OUTPUT DESCRIPTION Q1 Lubricating pump Q2 Milling machine switch I2 NO Star/Stop t toggle switch 3. There are three machines, each with its own start/stop buttons. Only one may run at a time. I/O Allocation Table for Problem 3 INPUT I1 DESCRIPTION NO Start/Stop toggle OUTPUT DESCRIPTION Q1 Machine 1 Q2 Machine 2 Q3 Machine 3 switch I2 NO Start/Stop toggle switch I3 NO Start/Stop toggle switch Experiment 1 – Intro to PLC Programming Page | 11 4. There are three hazard inputs to the alarm system that go ON as some operational malfunction occurs. We do not define what the hazards are; we only use the fact that there are four. The system operates as follows: If one input is ON, nothing happens. If any two inputs are ON, a red lamp goes ON. If all three are ON, the red lamp and a siren are both activated. I/O Allocation Table for Problem 4 INPUT I1 DESCRIPTION NO Start/Stop toggle OUTPUT DESCRIPTION Q1 Red Lamp Q2 Siren switch I2 NO Start/Stop toggle switch I3 NO Start/Stop toggle switch Experiment 1 – Intro to PLC Programming Page | 12