fundamentals of plc final

Upload: tetsusaiga

Post on 05-Apr-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Fundamentals of PLC Final

    1/117

    Fundamentals of PLC

  • 7/31/2019 Fundamentals of PLC Final

    2/117

    Contents :

    -Introduction

    -Plc architecture

    -Input/output (i/o) devices

    -Input/output signals.

    -Plc programming

    -Examples-Timers & counters

    -Logic symbols, truth tables, and equivalent ladder/plc

    logic diagrams

    -Number systems

  • 7/31/2019 Fundamentals of PLC Final

    3/117

    Session 1

    Outline:

    What is a PLC?Why Use PLCs ? Advantages.What are the Main Components of PLC?

  • 7/31/2019 Fundamentals of PLC Final

    4/117

    What is a PLC?PLC Programmable Logic Controller

    So, what is it?

    It is a Microprocessor-Based device

    used to control equipment in an industrial applications

    Applications of PLCsConveyor Systems,

    Food Processing Machinery, [e.g. filling

    bottles (water, soft drinks, canned food)]

    Auto Assembly (e.g. automobile industry)

    Fluid Level Control ( e.g. water tanks)Mixing Fluids (paint industries)

    Motor speed control

  • 7/31/2019 Fundamentals of PLC Final

    5/117

    Industrial Control systems

    In a traditional industrial control system,

    all control devices are wired directly

    Let us say that a push button is supposed to control the operation of amotor. In a traditional control system, the push button would be wireddirectly to the motor. In a PLC system, however, both the push buttonand the motor would be wired to the PLC instead. Then, the PLCs controlprogram would complete the electrical circuit between the two, allowingthe button to control the motor.

  • 7/31/2019 Fundamentals of PLC Final

    6/117

    In a PLC system:

    The PLC replaces the wiring between thedevices. Thus, instead of being wired directly toeach other, all equipment is wired to the PLC

    In a PLC System:1.The control program inside the PLC providesthe wiring connection between the devices.

    2.The control program is the computer programstored in the PLCs memory that tells the PLCwhats supposed to be going on in the system.3.The use of a PLC to provide the wiring connectionsbetween system devices may be called soft wiring.

    This soft wiring feature is useful

  • 7/31/2019 Fundamentals of PLC Final

    7/117

    Why Use PLC?

    PLC system

    Soft wiring

    control function is

    modified by just changing the control

    program inside the PLC

    These changes are easy and cheap

    Traditional system

    control function is

    modified by physically changingthe wiring between the devices

    This is costly and time consuming

    endeavor

    If you want a device in a PLC system to behave differently or to control a differentprocess element, all you have to do is change the control program. In a traditional

    system, making this type of change would involve physically changing the wiringbetween the devices, a costly and time-consuming endeavor.

  • 7/31/2019 Fundamentals of PLC Final

    8/117

    Why Use PLC

  • 7/31/2019 Fundamentals of PLC Final

    9/117

    Other Advantages of PLC

    In addition programming flexibility, PLC System

    offers:

    High reliability

    Reduced costs Expandability Computing capabilities Small space requirementsAbility to withstand harsh operating conditions

  • 7/31/2019 Fundamentals of PLC Final

    10/117

    A PLC basically consists of two elements: the central processing unit

    the input/output system

    The central processing unit (CPU)

    executes the controlprogram stored in the PLCs memory. Inessence, the CPU is the brains of a programmable controller. Itfunctions much the same way the CPU of a regular computer does,except that it uses special instructions and coding to perform its functions.The CPU has three parts: the processor the memory system

    the power supply

    Main Components of PLC?

  • 7/31/2019 Fundamentals of PLC Final

    11/117

    The central processing unit

    Theprocessor is the section of the CPU that codes, decodes, and computes

    (processes) data.The memory system is the section of the CPU that stores both the control

    program and data from the equipment connected to the PLC.

    Thepower supply is the section that provides the

    PLC with the voltage and current it needs to operate.

    CPU

    is a microprocessor systemis the PLC decision making unit. The CPU

    monitors the inputs and makes decisionsbased on instructions held in the programmemory. The

    CPU performs relay, counting, timing, datacomparison, and

    sequential operations.

  • 7/31/2019 Fundamentals of PLC Final

    12/117

    The Central Processing Unit (CPU)

    3 main parts:

    CPU

  • 7/31/2019 Fundamentals of PLC Final

    13/117

    The I/O system is the section of a PLC to which all of the field devices are

    connected.

  • 7/31/2019 Fundamentals of PLC Final

    14/117

    Session 2

    Input/Output (I/O) Devices

  • 7/31/2019 Fundamentals of PLC Final

    15/117

    The Input/Output System

    The input/output (I/O) system is the section of a PLC to which allof the field devices are connected. If the CPU can be thought of as the

    brains of a PLC, then the I/O system can be thought of as the armsand legs. The I/O system is what actually physically carries out thecontrol commands from the program stored in the PLCs memory.

    The I/O system consists of two main parts:

    the rack I/O modules

    The rackis an enclosure with slots in it that is connected to the CPU.

    I/O modules are devices with connection terminals to which the

    field devices are wired. Together, the rack and the I/O modules formthe interface between the field devices and the PLC. When set upproperly, each I/O module is both securely wired to its correspondingfield devices and securely installed in a slot in the rack. Thiscreates the physical connection between the field equipment and thePLC. In some small PLCs, the rack and the I/O modules come prepackaged as one unit.

  • 7/31/2019 Fundamentals of PLC Final

    16/117

  • 7/31/2019 Fundamentals of PLC Final

    17/117

    Input/Output (I/O) Devices

  • 7/31/2019 Fundamentals of PLC Final

    18/117

    Input/Output (I/O) Devices

    I/O or field devices can mainly categorized as:

    They wait for a signal/data from thePLC to perform their control functions.

    Examples include Lights, horns,

    motors, and valves These devices stay

    put until the PLC

    says, You need to turn on now orYoud better open up your

    valve a little more,

    They supply a signal or datato the PLC. Examples are:

    Switches, Push Buttons,

    sensors, etc

    Input device tells the PLC,

    Hey, something is happeningOut hereyou need to check

    this out to

    see how it affects the controlprogram.

  • 7/31/2019 Fundamentals of PLC Final

    19/117

    Example on Input/Output Devices

    An overhead light fixture and its corresponding wall switch are good examplesof everyday inputs and outputs. The wall switch is an input-it provides a signal for the light to turn on. The overhead light is an output it waitsuntil the switch sends a signal before it turns on.Let us pretend that you have a souped-up overhead light/switch circuitthat contains a PLC. In this situation, both the switch and the light willbe wired to the PLC instead of to each other. Thus, when you turn on

    the switch, the switch will send its turn on signal to the PLC instead of to thelight. The PLC will then relay this signal to the light, which willthen turn on.

  • 7/31/2019 Fundamentals of PLC Final

    20/117

    Types of Input/Output Devices

    Digital (discrete)

    These are inputs and outputs

    that have only two states: ON

    and OFF, i.e. 1 or 0A 1 means that the device is

    on and a 0 means that the

    device is off.

    As a result, they send/receive

    simple signals to/from a PLC.

    Analog

    Are inputs and

    outputs that

    can have an

    infinite number of states.

    These devices can not only be on and off, butthey can also be barely on, almost totally on,

    not quite off, etc. These devices send/receivecomplex signals to/from a PLC. Theircommunications consist of a variety ofsignals, not just 1s and 0s.

  • 7/31/2019 Fundamentals of PLC Final

    21/117

    Types of Input/Output Devices

  • 7/31/2019 Fundamentals of PLC Final

    22/117

    EXAMPLEThe overhead light and switch we just discussed are both examples

    of discrete devices. The switch can only be either totally on or

    totally off at any given time. The same is true for the light.

    A thermometer and a control valve are examples of the other typeof I/O devices-analog. A thermometer is an analog input devicebecause it provides data that can have an infinite number of states.

    Temperature is not just hot or cold. It can have a variety of states,including warm, cool, moderate, etc. A control valve is an analog

    output for the same reason. It can be totally on or totally off,but it can also have an infinite number of settings between

    these two states.

  • 7/31/2019 Fundamentals of PLC Final

    23/117

    TerminologyThe language of PLCs consists of a commonly used setof terms; many of which are unique to PLCs. In order to

    understand the ideas and concepts of PLCs, an understandingof these terms is necessary.

    Sensor

    A sensor is a device that converts a physical condition into anelectrical signal for use by the PLC. Sensors are connected tothe input of a PLC. A pushbutton is one example of a sensorthat is connected to the PLC input. An electrical signal is sentfrom the pushbutton to the PLC indicating the condition (open/

    closed) of the pushbutton contacts.

  • 7/31/2019 Fundamentals of PLC Final

    24/117

    Actuators

    Actuators convert an electrical signal from the PLC into a physicalcondition. Actuators are connected to the PLC output.

    A motor starter is one example of an actuator that is connected to

    the PLC output. Depending on the output PLC signal the motorstarter will either start or stop the motor

  • 7/31/2019 Fundamentals of PLC Final

    25/117

    Session 3

    Input/Output (I/O) signals

  • 7/31/2019 Fundamentals of PLC Final

    26/117

    More detailed for (I/P & O/P)

    I/PDiscrete InputA discrete input, also referred to as a digital input, is an inputthat is either in an ON or OFF condition. Pushbuttons, toggleswitches, limit switches, proximity switches, and contactclosures are examples of discrete sensors which are connectedto the PLCs discrete or digital inputs. In the ON condition a

    discrete input may be referred to as a logic 1 or a logic high. Inthe OFF condition a discrete input may be referred to as a logic0 or a logic low.

  • 7/31/2019 Fundamentals of PLC Final

    27/117

    A Normally Open (NO) pushbutton is used in the followingexample. One side of the pushbutton is connected to the firstPLC input. The other side of the pushbutton is connected to an

    internal 24 VDC power supply. Many PLCs require a separatepower supply to power the inputs. In the open state, no voltageis present at the PLC input. This is the OFF condition. When thepushbutton is depressed, 24 VDC is applied to the PLC input.This is the ON condition.

  • 7/31/2019 Fundamentals of PLC Final

    28/117

    Analog InputsAn analog input is an input signal that has a continuous signal.

    Typical analog inputs may vary from 0 to 20 milliamps, 4 to 20

    milliamps, or 0 to 10 volts. In the following example, a leveltransmitter monitors the level of liquid in a tank. Depending onthe level transmitter, the signal to the PLC can either increase ordecrease as the level increases or decreases.

  • 7/31/2019 Fundamentals of PLC Final

    29/117

    O/P

    Discrete Outputs

    A discrete output is an output that is either in an ON or OFFcondition. Solenoids, contactor coils, and lamps are examplesof actuator devices connected to discrete outputs. Discreteoutputs may also be referred to as digital outputs. In thefollowing example, a lamp can be turned on or off by the PLC

    output it is connected to.

  • 7/31/2019 Fundamentals of PLC Final

    30/117

    Analog OutputsAn analog output is an output signal that has a continuoussignal. The output may be as simple as a 0-10 VDC level that

    drives an analog meter. Examples of analog meter outputs arespeed, weight, and temperature. The output signal may alsobe used on more complex applications such as a current-to pneumatic transducer thatcontrols an air-operated flow-controlvalve.

  • 7/31/2019 Fundamentals of PLC Final

    31/117

    SESSION 4

    Programming

    A plc

  • 7/31/2019 Fundamentals of PLC Final

    32/117

    The control program is made up of things calledinstructions. Instructions are, in essence, little computer codes that make the inputs andoutputs do what you want in order to get the result you need. There are all different kindsof instructions and they can make a PLC do just about anything (add and subtract data, timeand count events, compare information, etc.). All you have to do is program the

    instructions in the proper order and make sure that they are telling the right devices what todo and voila!you have a PLC-controlled system. And remember, changing the system is asnap. If you want the system to act differently, just change the instructions in the controlprogram.

    Different PLCs offer different kinds of instructions. Thats part of whatmakes each type of PLC unique. However, all PLCs use two basic

    types of instructions: contacts coilsContacts are instructions that refer to the input conditions to thecontrol programthat is, to the information supplied by the inputfield devices. Each contact in the control program monitors a certain

    field device. The contact waits for the input to do something in particular(e.g., turn on, turn off, etc.this all depends on what type ofcontact it is). Then, the contact tells the PLCs control program, Theinput device just did what its supposed to do. Youd better check tosee if this is supposed to affect any of the output devices.

  • 7/31/2019 Fundamentals of PLC Final

    33/117

    Coils are instructions that refer to the outputs of the control programthat is,to what each particular output device is supposed to do in the system. Like acontact, each coil also monitors a certain field device. However, unlike acontact, which monitors the field device and then tells the PLC what to do, acoil monitors the PLC control program and then tells the field device what todo. It tells the output device, Hey, the PLC just told me that the switch turnedon. That means that youre supposed to turn on now. So lets go!ExampleLet us talk again about that souped-up switching circuit, in which a wall switch

    and an overhead light are connected to a PLC. Let us say that turning on theswitch is supposed to turn on the light. In this situation, the PLCs controlprogram would contain a contact that examines the input device -the wallswitch-for an on condition and a coil that references the light.When the switch turns on, the contact will

    energize meaning that it will tell the PLC that the condition its been lookingfor has happened. The PLC will relay this information to the coil instruction byenergizing it. This will let the coil know that it needs to tell its referencedoutput-the light-to turn on.

  • 7/31/2019 Fundamentals of PLC Final

    34/117

    The Control Program

    All PLCs use two basic instructions:

    1. Contacts 2. Coils

  • 7/31/2019 Fundamentals of PLC Final

    35/117

    A PLC Scan Cycle

    In PLC talk, this three-step process of monitoring the inputs, executingthe PLC control program, and changing the status of theoutputs accordingly is called the scan.

  • 7/31/2019 Fundamentals of PLC Final

    36/117

    Programming

    A program consists of one or more instructions that accomplisha task. Programming a PLC is simply constructing a set ofinstructions. There are several ways to look at a program suchas ladder logic, statement lists, or function block diagrams.Ladder Logic Ladder logic (LAD) is one programming language used

    with PLCs. Ladder logic uses components that resembleelements used in a line diagram format to describe hard-wiredcontrol.

  • 7/31/2019 Fundamentals of PLC Final

    37/117

    Ladder Logic Diagram

    The left vertical line of a ladder logic diagram represents the

    power or energized conductor. The output element or instructionrepresents the neutral or return path of the circuit. The rightvertical line, which represents the return path on a hard-wiredcontrol line diagram, is omitted. Ladder logic diagrams are readfrom left-to-right, top-to-bottom. Rungs are sometimes referred

    to as networks. A network may have several control elements,but only one output coil.

  • 7/31/2019 Fundamentals of PLC Final

    38/117

    In the example program shown example I0.0, I0.1 and Q0.0represent the first instruction combination. If inputs I0.0 andI0.1 are energized, output relay Q0.0 energizes. The inputs couldbe switches, pushbuttons, or contact closures. I0.4, I0.5, and

    Q1.1 represent the second instruction combination. If eitherinput I0.4 or I0.5 are energized, output relay Q0.1 energizes.

  • 7/31/2019 Fundamentals of PLC Final

    39/117

    Statement listA statement list (STL) provides another view of a set ofinstructions. The operation, what is to be done, is shown on theleft. The operand, the item to be operated on by the operation,is shown on the right. A comparison between the statementlist shown below, and the ladder logic shown on the previouspage, reveals a similar structure. The set of instructions in this

    statement list perform the same task as the ladder diagram.

  • 7/31/2019 Fundamentals of PLC Final

    40/117

    Function Block Diagrams

    Function Block Diagrams (FBD) provide another view of a set ofinstructions. Each function has a name to designate its specifictask. Functions are indicated by a rectangle. Inputs are shownon the left-hand side of the rectangle and outputs are shown onthe right-hand side. The function block diagram shown below

    performs the same function as shown by the ladder diagramand statement list.

  • 7/31/2019 Fundamentals of PLC Final

    41/117

    Introduction to PLC Programming

    1. System Block Diagram

    2. Basic Components and Their Symbols3. Ladder Diagram Fundamentals

    4. Applications

    PLC Block Diagram

  • 7/31/2019 Fundamentals of PLC Final

    42/117

    Basic Components and Their Symbols

    Head Push Button Switches

    Basic Components

  • 7/31/2019 Fundamentals of PLC Final

    43/117

    Limit Switches (LS)

    Limit switches can be mechanical or light activated switches

    Examples: limit switches on the refrigerator door that turns

    ON the inside or to open doors in supermarkets

    Basic Components

    Basic Components

  • 7/31/2019 Fundamentals of PLC Final

    44/117

    Basic Components

    Relays or Contactors Electromagnetic devices)

    Basic Components

  • 7/31/2019 Fundamentals of PLC Final

    45/117

    Push Button (PB) Switches

    Normally Open

    (NO or N/O)Normally Closed(NC or N/C)

    One PB withboth

    NO and NCcontacts

    Basic Components

    Basic Components

  • 7/31/2019 Fundamentals of PLC Final

    46/117

    Basic Components

    Relays Symbols

    Basic Components

  • 7/31/2019 Fundamentals of PLC Final

    47/117

    Basic Components

    CR

    control relay

    (internal relay or software relay)

    When coil CR1 is energized,

    all the N/O CR1 contacts will

    be closed and all the N/C CR1

    contacts will be open.

    Likewise, if coil CR1 is de-energized, all the N/O CR1 contacts

    will be open and all the N/C CR1 contacts will be closed.

    A contact labeled CR indicates that it is associated with a relay coil.

    Each relay will have a specific number associated with it. The

    range of numbers used will depend upon the number of relays in

    the system.

  • 7/31/2019 Fundamentals of PLC Final

    48/117

    EXAMPLES

    SESSION 5

  • 7/31/2019 Fundamentals of PLC Final

    49/117

    Example: AND Circuit

  • 7/31/2019 Fundamentals of PLC Final

    50/117

  • 7/31/2019 Fundamentals of PLC Final

    51/117

    Example: AND/OR Circuit

    The left vertical line of a ladderlogic diagram represents the

    power or energized conductor.The output element orinstruction represents the neutralor return path of the circuit.

    Example: Two Rungs LD

  • 7/31/2019 Fundamentals of PLC Final

    52/117

    Example: Two Rungs LD

    AC M t St t (C t t )

  • 7/31/2019 Fundamentals of PLC Final

    53/117

    AC Motor Starter (Contactor)

    AC motor starters

    are used to allowcontrol circuitry (low

    voltage/low current)

    to control high

    current high voltage

    power circuit

    AC Motor Starter

  • 7/31/2019 Fundamentals of PLC Final

    54/117

    AC Motor Starter

    Three heavy-duty N/O main contactors, one light-dutyN/C auxiliary contactors, and one light-duty N/C

    overload contactor

    AC Motor Starter (Contd)

  • 7/31/2019 Fundamentals of PLC Final

    55/117

    AC Motor Starter (Contd)

    Terminals are labeled

    Designers refer to theselabels on the schematic

    diagram

    as shown in the figure.

    The coil of the contactor all

    of the main contacts and

    the auxiliary contacts

    The overload contactor is independent on

    the contactor

    coil and only operates under overload

    conditions

  • 7/31/2019 Fundamentals of PLC Final

    56/117

    Example: AC Motor Start/Stop Circuit

  • 7/31/2019 Fundamentals of PLC Final

    57/117

    AC Motor Start/Stop Circuit (Contd)

  • 7/31/2019 Fundamentals of PLC Final

    58/117

    p ( )

    When the Start pushbutton is depressed the CPU

    receives a logic 1 from input I1.

    This causes the I1 contact to close. All

    three inputs are now a logic 1. The CPU sends a logic 1 to

    output [Q1. The motor starter is energized and the motor

    starts.

  • 7/31/2019 Fundamentals of PLC Final

    59/117

    AC Motor Start/Stop Circuit (Contd)

  • 7/31/2019 Fundamentals of PLC Final

    60/117

    When the Start pushbutton is pressed, output [Q1 is now

    true and on the next scan, when normally open contactQ1 is solved, the contact will close and output [Q1 will

    stay on even if the Start pushbutton has been released.

    AC M t St t/St Ci it ( td)

  • 7/31/2019 Fundamentals of PLC Final

    61/117

    The motor will continue to run until the Stop pushbutton is

    depressed. Input i2 will now be a logic 0 (false).

    The CPU will send a binary 0 to output [Q1.

    The motor will turn off.

    AC Motor Start/Stop Circuit (contd):

    AC Motor Start/Stop Circuit (contd):

  • 7/31/2019 Fundamentals of PLC Final

    62/117

    AC Motor Start/Stop Circuit (cont d):

    When the Stop pushbutton is released i2 logic function

    will again be true and the program ready for the next

    time the Start pushbutton is pressed.

    AC Motor Start/Stop Circuit: Adding

  • 7/31/2019 Fundamentals of PLC Final

    63/117

    Indicator lightsfor RUN and

    STOP conditions

    are included.

    RUN indicator

    light is connectedto output Q1

    STOP indicatorlight is connected

    to output Q2.

    AC Motor Start/Stop Circuit: Adding

    Light Indicators

    AC Motor Start/Stop Circuit: Adding

  • 7/31/2019 Fundamentals of PLC Final

    64/117

    AC Motor Start/Stop Circuit: Adding

    Light Indicators (contd):

    AC Motor Start/Stop Circuit: Adding

  • 7/31/2019 Fundamentals of PLC Final

    65/117

    When the PLCstarts the motor

    output [Q1 is ON.

    The N/O Q1 isclosed and output

    [Q1 turns theRUN indicator ON.

    The N/C q1contacts is open

    and the STOP

    indicator lightconnected to

    output [Q2 is

    OFF.

    AC Motor Start/Stop Circuit: Adding

    Light Indicators (contd):

    AC Motor Start/Stop Circuit: Adding

  • 7/31/2019 Fundamentals of PLC Final

    66/117

    AC Motor Start/Stop Circuit: AddingLight Indicators (contd):

    AC Motor Start/Stop Circuit: Adding

  • 7/31/2019 Fundamentals of PLC Final

    67/117

    Limit Switch

    A limit switch could

    be used to stop themotor or prevent the

    motor from being

    started.

    If the access door is

    open, the normallyopen contacts of LS1

    connected to input I3

    are open and the

    motor will not start.

    When the access door is closed, the N/O

    contacts on the limit switch (LS1) are closed.

    Input I4 is now ON, and the motor will start

    when the Start pushbutton is pressed.

  • 7/31/2019 Fundamentals of PLC Final

    68/117

  • 7/31/2019 Fundamentals of PLC Final

    69/117

  • 7/31/2019 Fundamentals of PLC Final

    70/117

  • 7/31/2019 Fundamentals of PLC Final

    71/117

  • 7/31/2019 Fundamentals of PLC Final

    72/117

  • 7/31/2019 Fundamentals of PLC Final

    73/117

  • 7/31/2019 Fundamentals of PLC Final

    74/117

  • 7/31/2019 Fundamentals of PLC Final

    75/117

    session 6

    Timers & counters

    Ti

  • 7/31/2019 Fundamentals of PLC Final

    76/117

    Timers

    Timers are

    devicesthat count

    increments

    of time.

    In this example

    timers are used to

    control the length

    of time between

    signal changes.

  • 7/31/2019 Fundamentals of PLC Final

    77/117

    S7-200 Timers

    S7-200 timers are provided with resolutions of 1 millisecond,10 milliseconds, and 100 milliseconds. The maximum value ofthese timers is 32.767 seconds, 327.67 seconds, and 3276.7seconds, respectively. By adding program elements, logic canbe programmed for much greater time intervals.

    Hard-Wired Timing Circuit

    Timers used with PLCs can be compared to timing circuits usedin hard-wired control line diagrams. In the following example, anormally open (NO) switch (S1) is used with a timer (TR1). Forthis example the timer has been set for 5 seconds. When S1

    is closed, TR1 begins timing. When 5 seconds have elapsed,TR1 will close its associated normally open TR1 contacts,

  • 7/31/2019 Fundamentals of PLC Final

    78/117

    illuminating pilot light PL1. When S1 is open, de energizing TR1,the TR1 contacts open, immediately extinguishing PL1. This typeof timer is referred to as ON delay. ON delay indicates that once

    a timer receives an enable signal, a predetermined amount oftime (set by the timer) must pass before the timers contactschange state.

    On-Delay (TON)

  • 7/31/2019 Fundamentals of PLC Final

    79/117

    When the On-Delay timer (TON) receives an enable (logic 1) atits input (IN), a predetermined amount of time (preset time - PT)

    passes before the timer bit (T-bit) turns on. The T-bit is a logicfunction internal to the timer and is not shown on the symbol.The timer resets to the starting time when the enabling inputgoes to a logic 0.

    In the following simple timer example a

  • 7/31/2019 Fundamentals of PLC Final

    80/117

    In the following simple timer example, aswitch is connected toinput I0.3, and a light is connected to

    output Q0.1.

    When the switch is closed input 4 becomes alogic 1, whichis loaded into timer T37. T37 has a time base of100 ms (.100seconds). The preset time (PT) value has beenset to 150. Thisis equivalent to 15 seconds (.100 x 150 ). Thelight will turn on

    15 seconds after the input switch is closed. Ifthe switch wereopened before 15 seconds had passed, thenreclosed, the timerwould again begin timing at 0.

  • 7/31/2019 Fundamentals of PLC Final

    81/117

    A small sample of the flexibility of PLCs is shown in thefollowing program logic. By reprogramming the T37 contact as

    a normally closed contact, the function of the circuit is changedto cause the indicator light to turn off only when the timer timesout. This function change was accomplished without changingor rewiring I/O devices.

    Retentive On-Delay (TONR)The Retentive On-Delay timer (TONR)

  • 7/31/2019 Fundamentals of PLC Final

    82/117

    functions in a similarmanner to the On-Delay timer (TON). There is one difference.The Retentive On-Delay timer times as long as the enabling

    input is on, but does not reset when the input goes off. Thetimer must be reset with a RESET (R) instruction.

    The same example used with the On-Delay timer will be

  • 7/31/2019 Fundamentals of PLC Final

    83/117

    p yused with the Retentive On-Delay timer. When the switch isclosed at input I0.3, timer T5 (Retentive timer) begins timing.If, for example, after 10 seconds input I0.3 is opened the timer

    stops. When input I0.3 is closed the timer will begin timing at10 seconds. The light will turn on 5 seconds after input I0.3has been closed the second time. A RESET (R) instructioncan be added. Here a pushbutton is connected to input I0.2.If after 10 seconds input I0.3 were opened, T5 can be reset by

    momentarily closing input I0.2. T5 will be reset to 0 and begintiming from 0 when input I0.3 is closed again.

    Off-Delay (TOF)

  • 7/31/2019 Fundamentals of PLC Final

    84/117

    The Off-Delay timer is used to delay an output off for a fixedperiod of time after the input turns off. When the enabling bitturns on the timer bit turns on immediately and the value is set

    to 0. When the input turns off, the timer counts until the presettime has elapsed before the timer bit turns off.

    S7-200 Timers

  • 7/31/2019 Fundamentals of PLC Final

    85/117

    The S7-200s have 256 timers. The specific T number chosen

    for the timer determines its time base and whether it is TON,TONR, or TOF.

    Timer Example

  • 7/31/2019 Fundamentals of PLC Final

    86/117

    Timer Example

    In the following example a tank will be filled with twochemicals, mixed, and then drained. When the Start Button ispressed at input I0.0, the program starts pump 1 controlled byoutput Q0.0. Pump 1 runs for 5 seconds, filling the tank withthe first chemical, then shuts off. The program then starts pump2, controlled by output Q0.1. Pump 2 runs for 3 seconds fillingthe tank with the second chemical. After 3 seconds pump 2shuts off. The program starts the mixer motor, connected to

    output Q0.2 and mixes the two chemicals for 60 seconds. Theprogram then opens the drain valve controlled by output Q0.3,and starts pump 3 controlled by output Q0.4. Pump 3 shuts offafter 8 seconds and the process stops. A manual Stop switch isalso provided at input I0.1.

  • 7/31/2019 Fundamentals of PLC Final

    87/117

  • 7/31/2019 Fundamentals of PLC Final

    88/117

  • 7/31/2019 Fundamentals of PLC Final

    89/117

    Counters are represented by boxes in ladder logic. Countersincrement/decrement one count each time the input transitions

    from off (logic 0) to on (logic 1). The counters are reset whena RESET instruction is executed. S7-200 uses three types ofcounters: up counter (CTU), down counter (CTD), and up/downcounter (CTUD).

    S7-200 Counters

  • 7/31/2019 Fundamentals of PLC Final

    90/117

    S7 00 Cou e sThere are 256 counters in the S7-200, numbered C0 throughC255. The same number cannot be assigned to more thanone counter. For example, if an up counter is assigned number45, a down counter cannot also be assigned number 45. The

    maximum count value of a counter is 32,767.Up CounterThe up counter counts up from a current value to a preset value(PV). Input CU is the count input. Each time CU transitions froma logic 0 to a logic 1 the counter increments by a count of 1.

    Input R is the reset. A preset count value is stored in PV input.If the current count is equal to or greater than the preset valuestored in PV, the output bit (Q) turns on (not shown).

  • 7/31/2019 Fundamentals of PLC Final

    91/117

    Down CounterThe down counter counts down from the presetvalue (PV) eachtime CD transitions from a logic 0 to a logic 1. When the current

    value is equal to zero the counter output bit (Q) turns on (notshown). The counter resets and loads the current value with thepreset value (PV) when the load input (LD) is enabled.

    Up/Down CounterThe up/down counter counts up or down fromth t l

  • 7/31/2019 Fundamentals of PLC Final

    92/117

    the preset valueeach time either CD or CU transitions from a logic 0 to a logic 1.

    When the current value is equal to the preset value, the outputQU turns on. When the current value (CV) is equal to zero, theoutput QD turns on. The counter loads the current value (CV)

    with the preset value (PV) when the load input (LD) is enabled.Similarly, the counter resets and loads the current value (CV)

    with zero when the reset (R) is enabled. The counter stopscounting when it reaches preset or zero.

    Counter ExampleA counter might be used to keep track of the number

  • 7/31/2019 Fundamentals of PLC Final

    93/117

    of vehicles in a parking lot. As vehicles enter the lot through anentrance gate, the counter counts up. As vehicles exit the lot

    through an exit gate, the counter counts down. When the lot isfull a sign at the entrance gate turns on indicating the lot is full.

  • 7/31/2019 Fundamentals of PLC Final

    94/117

  • 7/31/2019 Fundamentals of PLC Final

    95/117

    As cars leave the lot the exitgate opens. Input I0.1 transitions from a logic 0 to a logic 1,

    decrementing the count by 1. When the count has reached 150output Q0.1 transitions from a logic 0 to a logic 1. The ParkingLot Full sign illuminates. When a car exits, decrementing thecount to 149, the sign turns off.

  • 7/31/2019 Fundamentals of PLC Final

    96/117

    Session 7Logic Symbols, Truth Tables,

    and Equivalent Ladder/PLC

    Logic Diagrams

    EQUIVALENT LADDER/LOGIC DIAGRAMS

  • 7/31/2019 Fundamentals of PLC Final

    97/117

  • 7/31/2019 Fundamentals of PLC Final

    98/117

  • 7/31/2019 Fundamentals of PLC Final

    99/117

    Electrical Relay Diagram

    and

    PID Symbols

    www.industrialtext.com 1-800-752-8398

    ELECTRICAL RELAY DIAGRAM SYMBOLS

  • 7/31/2019 Fundamentals of PLC Final

    100/117

  • 7/31/2019 Fundamentals of PLC Final

    101/117

  • 7/31/2019 Fundamentals of PLC Final

    102/117

    PID SYMBOLS

  • 7/31/2019 Fundamentals of PLC Final

    103/117

  • 7/31/2019 Fundamentals of PLC Final

    104/117

    INSTRUMENT IDENTIFICATION LETTERING

  • 7/31/2019 Fundamentals of PLC Final

    105/117

  • 7/31/2019 Fundamentals of PLC Final

    106/117

    session8

    Number Systems

    Number Systems

  • 7/31/2019 Fundamentals of PLC Final

    107/117

    Since a PLC is a computer, it stores information in the form ofOn or Off conditions (1 or 0), referred to as binary digits (bits).Sometimes binary digits are used individually and sometimesthey are used to represent numerical values.Decimal SystemVarious number systems are used by PLCs. All

    number systemshave the same three characteristics: digits, base, weight. Thedecimal system, which is commonly used in everyday life, hasthe following characteristics:

    Ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9Base 10

    Weights 1, 10, 100, 1000, ...

    Binary SystemThe binary system is used by programmable controllers. The

  • 7/31/2019 Fundamentals of PLC Final

    108/117

    binary system has the following characteristics:Two digits 0, 1Base 2Weights Powers of base 2 (1, 2, 4, 8, 16, ...)In the binary system 1s and 0s are arranged into columns. Eachcolumn is weighted. The first column has a binary weight of20. This is equivalent to a decimal 1. This is referred to as theleast significant bit. The binary weight is doubled with each

    succeeding column. The next column, for example, has a weightof 21, which is equivalent to a decimal 2. The decimal value isdoubled in each successive column. The number in the far lefthand column is referred to as the most significant bit. In thisexample, the most significant bit has a binary weight of 27. This

    is equivalent to a decimal 128.

    Converting BinaryThe following steps can be used to interpret adecimal

  • 7/31/2019 Fundamentals of PLC Final

    109/117

    d cto Decimal number from a binary value.1) Search from least to most significant bit for 1s.

    2) Write down the decimal representation of each columncontaining a 1.3) Add the column values.In the following example, the fourth and fifth columns from the

    right contain a 1. The decimal value of the fourth column fromthe right is 8, and the decimal value of the fifth column fromthe right is 16. The decimal equivalent of this binary number is24. The sum of all the weighted columns that contain a 1 is thedecimal number that the PLC has stored.

    In the following example the fourth and sixth columns from the

  • 7/31/2019 Fundamentals of PLC Final

    110/117

    g pright contain a 1. The decimal value of the fourth column fromthe right is 8, and the decimal value of the sixth column from

    the right is 32. The decimal equivalent of this binary number is40.

    Bits, Bytes, and Words Each binary piece of data is a bit. Eightbits make up one byte.

    Two bytes, or 16 bits, make up one word.

    Logic 0, Logic 1 Programmable controllers can only understand ai l th t

  • 7/31/2019 Fundamentals of PLC Final

    111/117

    signal thatis On or Off (present or not present). The binary system is a

    system in which there are only two numbers, 1 and 0. Binary 1indicates that a signal is present, or the switch is On. Binary 0indicates that the signal is not present, or the switch is Off.

    BCD

    Binary-Coded Decimal (BCD) are decimal numbers where

  • 7/31/2019 Fundamentals of PLC Final

    112/117

    each digit is represented by a four-bit binary number. BCD iscommonly used with input and output devices. A thumbwheel

    switch is one example of an input device that uses BCD. Thebinary numbers are broken into groups of four bits, each grouprepresenting a decimal equivalent. A four-digit thumbwheelswitch, like the one shown here, would control 16 (4 x 4) PLC

    inputs.

    Hexadecimal

    Hexadecimal is another system used in PLCs The hexadecimal

  • 7/31/2019 Fundamentals of PLC Final

    113/117

    Hexadecimal is another system used in PLCs. The hexadecimalsystem has the following characteristics:

    16 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, FBase 16Weights Powers of base 16 (1, 16, 256, 4096 ...)The ten digits of the decimal system are used for the first tendigits of the hexadecimal system. The first six letters of the

    alphabet are used for the remaining six digits.A = 10 D = 13B = 11 E = 14C = 12 F = 15

    The hexadecimal system is used in PLCs because it allows thestatus of a large number of binary bits to be represented in asmall space such as on a computer screen or programming

  • 7/31/2019 Fundamentals of PLC Final

    114/117

    small space such as on a computer screen or programmingdevice display. Each hexadecimal digit represents the exactstatus of four binary bits. To convert a decimal number to a

    hexadecimal number the decimal number is divided by the baseof 16. To convert decimal 28, for example, to hexadecimal:

    Decimal 28 divided by 16 is 1 with a remainder of 12. Twelve isequivalent to C in hexadecimal. The hexadecimal equivalent ofdecimal 28 is 1C.The decimal value of a hexadecimal number is obtained bymultiplying the individual hexadecimal digits bythe base 16 weight and then adding the results.

    In the following examplethe hexadecimal number 2B is convertedto its decimal equivalent of 43.

  • 7/31/2019 Fundamentals of PLC Final

    115/117

    Conversion of Numbers

    The following chart shows a few numeric values indecimal,binary, BCD, and hexadecimal representation.

  • 7/31/2019 Fundamentals of PLC Final

    116/117

    Adviser :

    D YEHIA EL MASHAD

  • 7/31/2019 Fundamentals of PLC Final

    117/117

    Dr. YEHIA EL MASHAD

    prepared by:

    ABDALLA MOKTAR ABD EL MONSER

    HASAN ADEL HASAN

    HODA HOSNY ABBAS

    SHAIMAA MOHAMMED BARAKAT

    SHAIMAA TALAAT