Ladder Logic Programming Tutorial STEP1 - Download as DOC by mui27967

VIEWS: 109 PAGES: 18

									EME 240 Mechatronics and Smart System Design                                January 2009
Lesson 09: Introduction to Ladder Logic

Reading Assignment:
Read from your e-text: Lessons in Electric Circuits
 Chapter 6: Ladder Logic

Ladder logic represents a graphical way of representing logical flow and control. In
many companies, the electrical documentation is presented using circuits that are very
similar to the ladder logic form. We will find that ladder logic is also used as a graphical
computer language for simulating and testing control programs for programmable logic
controllers (PLCs).

Today you are going to learn to develop ladder logic programs by using the ladder logic
simulation package Pico Soft produced by the Rockwell company. You don’t have to
know how to write program code. You just have to learn how to set up switches, inputs,
and outputs within a graphical user environment. Once formed, you will be able to use
the testing features of the software to simulate the behavior of the control program and
run your control system to see if it performs as expected.

                  Start               Stop
                  SW1                 SW2             RLY1


Following today’s class, you should be able to

1) Learn Ladder Logic Structure.

2) Use the Pico Soft application to create a ladder logic control system.

3) Use Pico Soft to simulate and monitor the behavior of a ladder logic diagram.

As assigned in homework yesterday, you should have already downloaded and installed
Pico Soft Version 6.1 from the website:


At this time, start the PicoSoft software. You will use it as we explore the use of ladder
Ladder Logic

Ladder logic is a symbolic representation of an electrical circuit. It is also used as the
symbolic programming language used in industry to communicate with programmable
logic controllers (PLCs). They are called "ladder" diagrams because they look like a
ladder with horizontal and vertical rails. The left vertical leg represent power supply and
right vertical leg represents the ground state. The horizontal “rungs” represent each
individual control circuit.

Power is always supplied on the left. Ground is always the vertical line on the right.
Inputs always lie on the left side of a rung. Outputs always lie toward the right end of
the rung.

Let’s see if you understand. On the following ladder logic diagram, which lights will be
lit for each control rung? The term ON means the momentary switch is pushed; the term
OFF means the momentary switch is not pushed. Recall the following symbols represent


         Input ON                                                            On

         Input OFF                                                           On

          Input ON                                                          Off


          Input OFF                                                         Off

In ladder logic, each rung represents the logic control circuit of one and only one output.
Only one output may only be placed on any single rung.

However, there may be multiple switches or contacts that are used on each rung and each
input switch may occur on multiple rungs.

Multiple contacts:
When contacts are in series, each switch must make contact in order for power to be
supplied to the output. Recall that Normally Open switches make contact when they are
“On”. Normally Closed switches make contact when they are “Off”.

Try the following examples:

                           Sw A     Sw B
         Sw A: On
1)                                                                            Off
         Sw B: Off


                          Sw A     Sw B
         Sw A: On
2)       Sw B: On                                                             Off


3)                        Sw A     Sw B
         Sw A: Off
         Sw B: Off

                          Sw A     Sw B Sw C
4)       Sw A: On
         Sw B: On                                                             Off
         Sw C: On
                          Sw A     Sw B Sw C
5)       Sw A: Off
         Sw B: On                                                             On
         Sw C: On

                          Sw A     Sw B Sw C
         Sw A: On
6)       Sw B: Off                                                            On
         Sw C: Off
Rungs may also include branches that contain contacts. Only one branch needs to be
complete in order to supply power to the output on the rung.

Try these examples:

                          Sw A
          Sw A: Off                                                       On
1)        Sw B: Off
                           Sw B                            Light

          Sw A: Off       Sw A               Sw C
          Sw B: On                                                        Off
          Sw C: On
                           Sw B                            Light

          Sw A: Off       Sw A     Sw B      Sw E
3)        Sw B: On                                                         On
          Sw C: On
          Sw D: On         Sw C Sw D                       Light
          Sw E: Off

                          Sw A               Sw E
          Sw A: Off
D)        Sw B: Off
          Sw C: On         Sw B    Sw C
          Sw D: On                                         Light
          Sw E: Off
                           Sw D
      PicoSoft Overview:
      The following steps show the normal progression of implementing a control program
      using the Pico Soft application.

     Step 1: Design control structure:
         Start               Stop
         SW1                 SW2           RLY1


                                                                       Step 2: Pick

Step 3: Construct
Ladder in PicoSoft

                                                                       Step 4: Run
                                                                       Simulation and Test
                                                                       Ladder Logic

             Step 5: Download
             Program to PLC and
             and Run Actual
What is PicoSoft?

PicoSoft/PicoSoft Pro is a PC program that enables you to
  -- create,
  -- save,
  -- simulate,
  -- document,
  -- download programs to a connected, operating Pico/Pico GFX controllers.
  -- display status of the controller during operation.

A functional ladder logic circuit diagram can be created simply by selecting contacts and
coils, function relays or function blocks from the Toolbox window in the Circuit
Diagram View. You simply select these circuit diagram elements from the Toolbox and
place them in the Circuit Diagram window using drag and drop with your mouse.

You can also use the mouse to draw connections between the individual circuit diagram
elements in addition to the connections that are created automatically.

Comments can also be created for contacts and coils in order to provide greater clarity. A
cover sheet, the entry fields and the cross-reference lists with comments can be printed
out to create ideal documentation in which you can even insert your company logo.

The simulation tool allows you to test the completed circuit diagram without the device
having to be connected up. You can test the circuit diagram in sections or in its entirety
and use the simulated inputs, outputs, break points, forcing and display features to help

The program also allows the tested circuit diagram to be transferred to the device using
the PC cable to connect the device to the PC.

Adding operands to the circuit diagram
After entering the Circuit Diagram View Mode, operands can be added to rungs by:
1) Click and Drag the operand from the Operand List onto the desired rung location.
2) Position the curser using the mouse or arrow keys on the rung structure and use the
quick key combinations to select the operand.

After selecting the operand, you will specify its parameters on the Properties filed
directly below the Rung structure.
Keys and key combinations in the project and circuit diagram view
Purpose                                   Key (function key) / key combination
Open new project                          CTRL+N
Open existing project                     CTRL+O
Save project                              CTRL+S (in every view)
Shut down PicoSoft/PicoSoft Pro           ALT+F4

Keys and key combinations in the Circuit Diagram and Visualization View

Purpose                                   Key/key combination
Undo operation                            CTRL+Z
Restore operation                         CTRL+Y
Abort operation                           ESC (in the Circuit Diagram view)
Cut                                       CTRL+X
Copy                                      CTRL+C
Paste                                     CTRL+V
Delete                                    DEL
Select All                                CTRL+A
Go To Rung...                             CTRL+G
Find operand                              CTRL+F
Insert Rung                               CTRL+I
Delete Rung                               CTRL+D

Arranging screen elements
Align left                                Shift + Cursor left
Align right                               Shift + Cursor right
Align top                                 Shift + Cursor up
Align bottom                              Shift + Cursor down
Arrange horizontally                      Shift+CTRL+Cursor left
Arrange vertically                        Shift+CTRL+Cursor down
Flip horizontally                         CTRL+H
Flip vertically                           CTRL+J
Rotate to right                           CTRL+R
Rotate to left                            CTRL+L
Complete Set of Pico PLC Operands:
               Operand                  Controller                      Key/key
             ID/Function                                                combination
 I      Bit input                       Pico and Pico GFX               i
 ID     Diagnostics input               Pico GFX                        SHIFT+I+D
 M      Marker bit                      Pico and Pico GFX               m
 P      P button                        Pico and Pico GFX               p
 Q      Bit output                      Pico and Pico GFX               q
 R      Bit input - Expansion device    Pico 1760-L18... and Pico GFX   r
 RN     Bit input via the NET           Pico GFX                        SHIFT+R+N
 S      Bit output - Expansion device   Pico 1760-L18... and Pico GFX   s
 SN     Bit output via the NET          Pico GFX                        SHIFT+S+N
 :      Jump                            Pico and Pico GFX               :

            Operand                     Controller                          Key/key
           ID/Function                                                      combination
 A      Analog values                   Pico and Pico GFX                   a
 AR     Arithmetic                      Pico GFX                            SHIFT+A+R
 BC     Data block comparator           Pico GFX                            SHIFT+B+C
 BT     Data block transfer             Pico GFX                            SHIFT+B+T
 BV     Boolean operation               Pico GFX                            SHIFT+B+V
 C      Counter relay                   Pico and Pico GFX                   c
 CF     Frequency counter               Pico GFX                            SHIFT+C+F
 CH     High-speed counter              Pico GFX                            SHIFT+C+H
 CI     Incremental counter             Pico GFX                            SHIFT+C+I
 CP     Comparator                      Pico GFX                            SHIFT+C+P
 D      Text display                    Pico 1760-L18...                    d
 DB     Data function block             Pico GFX                            SHIFT+D+B
 DC     PID controller                  Pico GFX                            SHIFT+D+C
 FT     PT1 signal smoothing filter     Pico GFX                            SHIFT+F+T
 GT     Get value from the NET          Pico GFX                            SHIFT+G+T
 H      7-day time switch               Pico                                h
 HW     7-day time switch               Pico GFX                            SHIFT+H+W
 HY     Year time switch                Pico GFX                            SHIFT+H+Y
 LS     Value scaling                   Pico GFX                            SHIFT+L+S
 MR     Master reset                    Pico GFX                            SHIFT+M+R
 NC     Numerical converter             Pico GFX                            SHIFT+N+C
 OT     Operating hours counter         Pico GFX                            SHIFT+O+T
 PT     Put value on the NET            Pico GFX                            SHIFT+P+T
 PW     Pulse width modulation          Pico GFX                            SHIFT+P+W
 SC     Synchronize device clocks via   Pico GFX                            SHIFT+S+C
        the NET
 ST     Set cycle time                  Pico GFX                            SHIFT+S+T
 T      Timing relay                    Pico and Pico GFX                   t
 VC     Value limitation                Pico GFX                            SHIFT+V+C
Common Operand Types:
I Input: This refers to a rung input. This is mapped to one of the 8 or 12 input ports on
the Pico controller. Each input can be defined as a Normally Open (Make) or Normally
Closed (Break) device.

P Button:
On the front of the actual controller there are 4 push buttons. These
buttons can be used to program the PLC as a stand alone device.
These buttons can also be used within an operating program as input
switches to the ladder logic program. They can each be defined in
the properties field as being NO or NC switches.

M Marker: A marker behaves like a typical relay (which PicoSoft calls a contactor).
Supplying a proper input level to the marker allows it to close contacts elsewhere as an
input operand. A marker can also be defined in the properties fields to behave as a devise
which changes states when it reaches an impulse (a low to high transition) which is called
an impulse relay. There are also variations of the marker operand which can be used to
Set Marker and Clear Marker.


 Marker as                                                                       Impulse Relay
 Input                                                                           Operand

                                                                                 Reset Marker
                                                                                 Set Marker
T Timer Relay:
You may define up to 16 different timing relays. A timing relay is used to simulate a
relay which delays the operation of its contacts for a given length of time. Delay times
may be between 10 ms and 99 hr 59 min. To use a timer you will define a Timer coil
operand (as an output) and a Timer contact operand (as an input). The property fields can
be used to define the time delay (set point) and additional properties of the operand. If
you don’t define the set point it will take on a value of 0.

                                                                              Timer coil



C Counter Relay: There are 16 individual counter relays which may be defined for use
(C1 to C16). A counter relay enables you to count events. The counter relay adds or
subtracts pulses and switches when the actual value is greater than or equal to the set
point. In other words after receiving a set number of pulses, the counter contacts will be
activated. The set point may be between 0000 and 32000. To use a counter you set up a
counter coil (as an output) and a counter contact (as an input). There is an additional
counter reset which can be selected using the appropriate properties field setting.


Start/Stop Circuit:

The circuit shown below is known as a start/stop circuit. In industrial applications, often
times a machine will have a Start button to begin a process and a separate Stop button to
shut the system off.

Implement this using your PicoSoft software:

                      Start              Stop
                      SW1                SW2             RLY1


If both the Start and Stop (shown as generic switches) are momentary push-button
switches, then answer the following questions.

Draw a picture (or symbol) of the pushbutton Start switch:

Draw a picture (or symbol) of the pushbutton Stop Switch.

What happens if the system is “off” and the Start button is pressed?

What happens if the system is “on” and the Stop button is pressed?
Using the Circuit Diagram Option, build the Ladder rung circuit shown below

Notice that to set Switch 2 as a break switch
you have to check the appropriate button in
the settings below when the switch is

Using the Simulation Option, next declare the type of input under the I/R tabe. For this
example make them both Column 2 switches (push to momentarily close).

                     Next Run the simulation, and work the switches under the I tab.

State Transitions:
More complicated control systems may often categorize the process into a number of
functional steps that need to be completed. One functional step only becomes active after
one that precedes it has been completed. After each step turns "Off", control is passed to
the next process step which follows it.

This can be implemented in a ladder diagram using the following structure.

             Sw 1               Sw 2            Rly 1
                                                             Stage 1
             Rly 1

             Sw 2               Sw 3             Rly 2
                                                             Stage 2
             Rly 2

             Sw 3               Sw 1             Rly 3
                                                              Stage 3
             Rly 3

As the process moves from one process stage to the next, the previous stage is turned off.
Only one process stage will be on at a time as the switches are activated.

Construct and demonstrate this control structure using PicoSoft


Boolean Logic as Ladder Logic:
Logical OR:    Two switches in parallel

Logical AND: Two switches in series

Logical NOT: Use of a Normally Closed switch

Unknown Example: Complete the truth table for the ladder circuit shown below.
What type of logic gate expression is indicated by the following Ladder Logic?

  A      B        Out
  0      0
  0      1
  1      0
  1      1

What is the Boolean Expression?      A  B+A  B = A  B

Additional Switch Options in PicoSoft:
Timer (or Timer Coil or Timer Relay):
This is a special kind of relay coil and switch. When the coil of this device is energized,
the device delays a fixed length of time before the contacts are closed. Once the contacts
are closed, they will remain closed as long as the coil remains energized. If the coil is de-
energized, the solenoid returns to it original position and the switch contacts immediately
open. For the contacts to again close, the coil must be energized through a full time

Signal to timer coil
                           delay                                     delay

Timer contact.

Counter (or Counter Coil):
This is a special kind of relay that engages a coil (thereby closing contacts) only after
receiving a given number of state transitions (typically OFF to ON). Usually the counter
is set with a number of counts which decrements with each transition. Then the counter
registers zero, the all of the counter's normally open contacts will be closed. The
contacts will remain ON regardless of whether the input to this device stays energized or
not. To turn OFF these contacts, requires that the device reset the counter using a special
counter reset function.

     to counter
                 for count value of 3

         Reset switch


EME240 Mechatronics and Smart System Design
Homework 09:

Problem 1: Conveyor Belt Process
Consider the conveyor belt system shown below. Manufactured parts of varying height
and weight move along a conveyor from left to right. The three zones perform the
following processes: Testing, Painting, and Diverting.

In the Testing Zone: Parts are sensed and classified. A height detector measures the
height of each part and classifies each as either tall or short. A weighing device classifies
each part as light or heavy. The sensors will therefore classify each part as one of four
                tall/light     tall/ heavy      short/light      short/heavy
A switch (LS1) detects when a part passes out of the Testing Zone.

In the Painting Zone: Parts are color-coded.
One of four different spray nozzles is turned on and used to paint a stripe on the part as it
passes under the spray stream. A switch (LS2) detects when a part passes out of the
Painting Zone.
In the Diverting Zone: Parts are sorted. One of four different gates is opened and used
to divert the part into an appropriate chute. A switch detects when a part has passed
down any of the chutes (LS3-LS6).
Ladder logic diagram of the switching network required to perform these operations.
Examine the system and its ladder logic diagram then answer the questions below:

1) What types of switch are appropriate to use for switches, LS1 – LS6?

2) How many relays are used in this system?

3) How many of the relays latch themselves after being energized?

4) What color do short/heavy parts get coded with?

5) What is the purpose of relay, RTAL?

6) The state of relay RDZ affects how many logic circuits (as in rungs)?

7) Which relays must be active for blue paint to be sprayed?

8) How does RDZ get turned off?

Reading Assignment:
Read from your e-text: Lessons in Electric Circuits
 Chapter 6: Ladder Logic

To top