Rob t 308 Lecture 18

download Rob t 308 Lecture 18

of 26

Transcript of Rob t 308 Lecture 18

  • 8/9/2019 Rob t 308 Lecture 18

    1/78

    ROBT 308Industrial Automation

    Lecture 18

     – Data manipulation instructions (part b)

     – Math Instructions

    17 March 2015, Tuesday

    Industrial Automation (ROBT308) - Spring 2015

  • 8/9/2019 Rob t 308 Lecture 18

    2/78

    Topics

    2

    Today’s Topics

    File arithmetic and logic (FAL) instruction

    File copy (COP) instruction and the fill file (FLL)

    Data comparison instructionsData Manipulation Programs

    Numerical Data I/O Interfaces

    Closed loop Control

    Math Instructions (Addition, Subtraction, Multiplication,Division)

    File Arithmetic Operations

    Industrial Automation (ROBT308) - Spring 2015

  • 8/9/2019 Rob t 308 Lecture 18

    3/78

    Industrial Automation (ROBT308) - Spring 2015   3

    A file is a group of related consecutive words in

    the data table that have a defined start and end 

    and are used to store information.Moving data using file instructions

  • 8/9/2019 Rob t 308 Lecture 18

    4/78

    Address #N7:30 represents the starting address of 

    a group of consecutive words in integer file 7.

    The length is eight words, which is determined by the

    instruction where the file address is used.

    Industrial Automation (ROBT308) - Spring 2015   4

    SLC 500 word and file addressing.

  • 8/9/2019 Rob t 308 Lecture 18

    5/78

    Industrial Automation (ROBT308) - Spring 2015   5

    The file arithmetic and

    logic (FAL) instruction is

    used to copy data fromone file to another and to

    do file math and file logic.

    Control word uses four control bits: enable bit, done bit, error bit,

    and unload bit.

    Length represents the file length in words.

    Position points to the word being operated on.

    Mode (All, Numeric or Incremental) represents the number of file

    elements operated on per program scan.

  • 8/9/2019 Rob t 308 Lecture 18

    6/78

    Industrial Automation (ROBT308) - Spring 2015   6

    Destination is the address at which the processor stores theresult of the operation.

    Expression contains addresses, program constants, and operators

    that specify the source of data and the operations to beperformed. The expression entered determines the function of

    the FAL instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    7/78

    Industrial Automation (ROBT308) - Spring 2015   7

    File-to-file copy function program using the FAL

    instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    8/78

    Industrial Automation (ROBT308) - Spring 2015   8

    File-to-word copy function using the FAL

    instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    9/78

    Industrial Automation (ROBT308) - Spring 2015   9

    Word-to-file copy function using the FAL

    instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    10/78

    Industrial Automation (ROBT308) - Spring 2015   10

    Copying recipes and storing values for timer

    presets.

  • 8/9/2019 Rob t 308 Lecture 18

    11/78

    Industrial Automation (ROBT308) - Spring 2015   11

    The file copy (COP) instruction and the fill file (FLL)

    instruction are high-speed instructions that operate

    more quickly than the same operation with the FALinstruction.

  • 8/9/2019 Rob t 308 Lecture 18

    12/78

    Industrial Automation (ROBT308) - Spring 2015   12

    There is no control element to monitor and data

    conversion does not take place, so the source and

    destination should be the same file types.

  • 8/9/2019 Rob t 308 Lecture 18

    13/78

    Industrial Automation (ROBT308) - Spring 2015   13

    Using the FLL instruction to change all the data in

    a file to zero.

  • 8/9/2019 Rob t 308 Lecture 18

    14/78

    Industrial Automation (ROBT308) - Spring 2015   14

    Data Compare Instructions

  • 8/9/2019 Rob t 308 Lecture 18

    15/78

  • 8/9/2019 Rob t 308 Lecture 18

    16/78

    Industrial Automation (ROBT308) - Spring 2015   16

    Comparison instructions are used to test pairs of

    values to determine if a rung is true.

    LIM (Limit test)  —Tests whether one value is within the limitrange of two other values.

    MEQ  (Masked Comparison for Equal)   —Tests portions of two

    values to see whether they are equal.

    Compares 16-bit data of a source address to 16-bit data at areference address through a mask.

  • 8/9/2019 Rob t 308 Lecture 18

    17/78

    Industrial Automation (ROBT308) - Spring 2015   17

    EQU (Equal)  —Tests whether two values are equal.

    NEQ (Not Equal)  —Tests whether one value is not equal to a

    second value.

    LES (Less Than)   —Tests whether one value is less than a

    second value.GRT (Greater Than)  —Tests whether one value is greater than

    a second value.

    LEQ  (Less Than or Equal)   —Tests whether one value is less

    than or equal to a second value.

    GEQ  (Greater Than or Equal)   —Tests whether one value isgreater than or equal to a second value.

  • 8/9/2019 Rob t 308 Lecture 18

    18/78

    Industrial Automation (ROBT308) - Spring 2015   18

    The equal (EQU) instruction rung compares the

    value of source A to that of source B.

    When source A is equal to source B, the instruction is logically

    true and PL1 is switched ON.

    When source A is not equal to source B, the instruction is logically

    false and PL1 is switched OFF.

  • 8/9/2019 Rob t 308 Lecture 18

    19/78

    Industrial Automation (ROBT308) - Spring 2015   19

    The not equal (NEQ) instruction is logically true

    when source A is not equal to source B, otherwise

    it is logically false.

  • 8/9/2019 Rob t 308 Lecture 18

    20/78

    Industrial Automation (ROBT308) - Spring 2015   20

    The greater than (GRT) instruction is logically

    true when source A is greater than source B,

    otherwise it is logically false.

  • 8/9/2019 Rob t 308 Lecture 18

    21/78

    Industrial Automation (ROBT308) - Spring 2015   21

    The less than (LES) instruction is logically true when

    source A is less than source B, otherwise it is

    logically false.

  • 8/9/2019 Rob t 308 Lecture 18

    22/78

    Industrial Automation (ROBT308) - Spring 2015   22

    The greater than or equal (GEQ) instruction is

    logically true when source A is greater than or

    equal to source B, otherwise it is logically false.

  • 8/9/2019 Rob t 308 Lecture 18

    23/78

  • 8/9/2019 Rob t 308 Lecture 18

    24/78

    Industrial Automation (ROBT308) - Spring 2015   24

    The limit test (LIM) instruction is used to test

    whether values are within or outside the

    specified range.

  • 8/9/2019 Rob t 308 Lecture 18

    25/78

    Industrial Automation (ROBT308) - Spring 2015   25

    The low limit is less than the high limit.

    Instruction is true for test values 25 through 50.

    Instruction is false for test values less than 25 or greater than 50.

  • 8/9/2019 Rob t 308 Lecture 18

    26/78

    Industrial Automation (ROBT308) - Spring 2015   26

    Instruction is true for test values of 50 and less than 50 and for

    test values of 100 and greater than 100.

    Instruction is false for test values greater than 50 and less than

    100.

    The low limit is greater than the high limit.

  • 8/9/2019 Rob t 308 Lecture 18

    27/78

    Industrial Automation (ROBT308) - Spring 2015   27

    The masked comparison for equal (MEQ)

    instruction compares a value from a source

    address with data at a compare address andallows portions of the data to be masked.

    The MEQ instruction can be used to compare the correct position of

    up to 16 limit switches when the source contains the limit switch

    address and the compare stores their desired states.

  • 8/9/2019 Rob t 308 Lecture 18

    28/78

    Industrial Automation (ROBT308) - Spring 2015   28

    MEQ instruction rung.

    When the data at the source address match the data at the

    compare address bit-by-bit (less masked bits), the instruction is

    true.

  • 8/9/2019 Rob t 308 Lecture 18

    29/78

    Industrial Automation (ROBT308) - Spring 2015   29

    Data Manipulation

    Programs

  • 8/9/2019 Rob t 308 Lecture 18

    30/78

    Industrial Automation (ROBT308) - Spring 2015   30

    Hardwired relay-operated, time-delay circuit.

  • 8/9/2019 Rob t 308 Lecture 18

    31/78

    Industrial Automation (ROBT308) - Spring 2015   31

    Equivalent programmed time-delay circuit.

  • 8/9/2019 Rob t 308 Lecture 18

    32/78

    Industrial Automation (ROBT308) - Spring 2015   32

    Timer program implemented using the EQU

    instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    33/78

    Industrial Automation (ROBT308) - Spring 2015   33

    Counter program implemented using the LES

    instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    34/78

    Industrial Automation (ROBT308) - Spring 2015   34

    Vessel filling

    operation.

    ØThe receiving vessel has its weight

    monitored continuously by the PLC

    program as it fills.

    ØWhen the weight reaches a preset

    value, the flow is cut off.

    ØShould the system leak additional material into the vessel, the

    total weight of the material could rise above the preset valuecausing an equal instruction, if used, to go false and the vessel to

    overfill.

  • 8/9/2019 Rob t 308 Lecture 18

    35/78

    Industrial Automation (ROBT308) - Spring 2015   35

    Numerical Data I/O

    Interfaces

  • 8/9/2019 Rob t 308 Lecture 18

    36/78

    Industrial Automation (ROBT308) - Spring 2015   36

    Multibit interfaces allow a

    group of bits to be input or

    output as a unit.Each one of the switches provides four

    binary digits at its output that

    correspond to the decimal number

    selected on the switch.

    The BCD input module allows the

    processor to accept the 4-bit digital

    codes and input their data into

    specific register or word locations.

  • 8/9/2019 Rob t 308 Lecture 18

    37/78

    Industrial Automation (ROBT308) - Spring 2015   37

    The seven-segment LED display

    is a typical Binary Coded

    Decimal output device.

    It displays a decimal number that

    corresponds to the BCD value it receives

    at its input.

    The BCD output module is used to

    output data from a specific register orword location.

  • 8/9/2019 Rob t 308 Lecture 18

    38/78

    Industrial Automation (ROBT308) - Spring 2015   38

    Program for monitoring the setting of a

    thumbwheel switch.

  • 8/9/2019 Rob t 308 Lecture 18

    39/78

    Industrial Automation (ROBT308) - Spring 2015   39

     Analog modules convert analog signals to 16-bit

    digital signals (input) or 16-bit digital signals to

    analog values (output).

    An analog I/O will allow

    monitoring and control ofanalog voltages and currents.

  • 8/9/2019 Rob t 308 Lecture 18

    40/78

    Industrial Automation (ROBT308) - Spring 2015   40

    The analog output interface module receives

    numerical data from the processor.

    These data are then translated into a proportional

    voltage or current to control an analog field

    device.

  • 8/9/2019 Rob t 308 Lecture 18

    41/78

  • 8/9/2019 Rob t 308 Lecture 18

    42/78

    Industrial Automation (ROBT308) - Spring 2015   42

    In open-loop control , no feedback loop is

    employed and system variations which cause the

    output to deviate from the desired value are notdetected or corrected.

    A closed-loop system utilizes feedback to

    measure the actual system operating parameter

    being controlled.

  • 8/9/2019 Rob t 308 Lecture 18

    43/78

    Industrial Automation (ROBT308) - Spring 2015   43

    PLC closed-loop control system.

    Adjustments are

    made continuously

    by the PLC until the

    difference between

    the desired andactual output is as

    small as is practical.

  • 8/9/2019 Rob t 308 Lecture 18

    44/78

  • 8/9/2019 Rob t 308 Lecture 18

    45/78

    Industrial Automation (ROBT308) - Spring 2015   45

    Proportional controls are designed to eliminate the

    hunting or cycling associated with on/off control.

    Proportional control

    allows the control

    element to take

    intermediatepositions between

    on and off.

    The PLC analog output module controls the amount of fluid flow by

    adjusting the percentage of valve opening.

  • 8/9/2019 Rob t 308 Lecture 18

    46/78

    Industrial Automation (ROBT308) - Spring 2015   46

    Proportional-integral-derivative (PID) control is

    the most sophisticated and widely used type of

    process control.

    PID controllers produce outputs that depend on the magnitude, duration, and

    rate of change of the system error signal.

  • 8/9/2019 Rob t 308 Lecture 18

    47/78

    Industrial Automation (ROBT308) - Spring 2015   47

    PID control loop

    ØOperating information from the machine is called the process variable or

    feedback.

    ØInput from the operator that tells the controller the desired operating point is

    called the set-point .

    ØThe difference between the set-point and the process variable is called the

    error.

  • 8/9/2019 Rob t 308 Lecture 18

    48/78

    Industrial Automation (ROBT308) - Spring 2015   48

    Programmable controllers are either equipped

    with PID I/O modules that produce PID control or

    have sufficient mathematical functions of theirown to allow PID control to be carried out.

  • 8/9/2019 Rob t 308 Lecture 18

    49/78

    Industrial Automation (ROBT308) - Spring 2015   49

    Math Instructions

  • 8/9/2019 Rob t 308 Lecture 18

    50/78

    Industrial Automation (ROBT308) - Spring 2015   50

    The PLC’s math functions capability allows it to

    perform arithmetic functions on values.

    Addition - The capability to add one piece of data to another.Subtraction - The capability to subtract one piece of data from

    another.

    Multiplication - The capability to multiply one piece of data by

    another.

    Division - The capability to divide one piece of data by another.

  • 8/9/2019 Rob t 308 Lecture 18

    51/78

    Industrial Automation (ROBT308) - Spring 2015   51

    When the CPT (compute)

    instruction is executed, then

    copy, arithmetic, logical, orconversion operation residing

    in the expression field of this

    instruction is performed and

    the result is sent to thedestination.

  • 8/9/2019 Rob t 308 Lecture 18

    52/78

    Industrial Automation (ROBT308) - Spring 2015   52

    Addition Instruction

  • 8/9/2019 Rob t 308 Lecture 18

    53/78

    Industrial Automation (ROBT308) - Spring 2015   53

    The ADD instruction performs the addition of two

    values stored in the referenced memory locations.

  • 8/9/2019 Rob t 308 Lecture 18

    54/78

    Industrial Automation (ROBT308) - Spring 2015   54

    Counter program that uses the ADD instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    55/78

    Industrial Automation (ROBT308) - Spring 2015   55

    The arithmetic status bits

    for the SLC 500 are found in

    word 0, bits 0 to 3 of the

    processor status file S2.

    Carry (C) - Address S2:0/0, is set to 1 when there is a carry in the

    ADD instruction or a borrow in the SUB instruction.

    Overflow (O) -Address S2:0/1, is set to 1 when the result is too

    large to fit in the destination register.

    Zero (Z) - Address S2:0/2, is set to 1 when the result of the subtract

    instruction is zero.

    Sign (S) - Address S2:0/3, is set to 1 when the result is a negative

    number.

  • 8/9/2019 Rob t 308 Lecture 18

    56/78

    Industrial Automation (ROBT308) - Spring 2015   56

    Subtraction Instruction

  • 8/9/2019 Rob t 308 Lecture 18

    57/78

    Industrial Automation (ROBT308) - Spring 2015   57

    The subtract instruction subtracts source B from

    source A and stores the result in the destination.

  • 8/9/2019 Rob t 308 Lecture 18

    58/78

    Industrial Automation (ROBT308) - Spring 2015   58

    Vessel overfill alarm program.

  • 8/9/2019 Rob t 308 Lecture 18

    59/78

    Industrial Automation (ROBT308) - Spring 2015   59

    Multiplication Instruction

  • 8/9/2019 Rob t 308 Lecture 18

    60/78

  • 8/9/2019 Rob t 308 Lecture 18

    61/78

    Industrial Automation (ROBT308) - Spring 2015   61

    MUL instruction program used to calculate the

    product of two sources.

  • 8/9/2019 Rob t 308 Lecture 18

    62/78

    Industrial Automation (ROBT308) - Spring 2015   62

    The MUL

    instruction

    used as part

    of atemperature

    control

    program.

  • 8/9/2019 Rob t 308 Lecture 18

    63/78

    Industrial Automation (ROBT308) - Spring 2015   63

    Division Instruction

  • 8/9/2019 Rob t 308 Lecture 18

    64/78

    Industrial Automation (ROBT308) - Spring 2015   64

    The division instruction divides the value in source

     A by the value in source B and stores the result in

    the destination address.

  • 8/9/2019 Rob t 308 Lecture 18

    65/78

    Industrial Automation (ROBT308) - Spring 2015   65

    DIV instruction used to calculate the value that

    results from dividing source A by source B.

  • 8/9/2019 Rob t 308 Lecture 18

    66/78

    Industrial Automation (ROBT308) - Spring 2015   66

    Program for

    converting

    Celsius

    temperature toFahrenheit.

  • 8/9/2019 Rob t 308 Lecture 18

    67/78

    Industrial Automation (ROBT308) - Spring 2015   67

    Other Word-Level Math

    Instructions

  • 8/9/2019 Rob t 308 Lecture 18

    68/78

    Industrial Automation (ROBT308) - Spring 2015   68

    Square root instruction.

  • 8/9/2019 Rob t 308 Lecture 18

    69/78

    Industrial Automation (ROBT308) - Spring 2015   69

    The negate (NEG) instruction changes the sign of

    the source value from positive to negative.

  • 8/9/2019 Rob t 308 Lecture 18

    70/78

    Industrial Automation (ROBT308) - Spring 2015   70

    The clear (CLR) instruction sets all bits of a word to

     zero.

  • 8/9/2019 Rob t 308 Lecture 18

    71/78

  • 8/9/2019 Rob t 308 Lecture 18

    72/78

    Industrial Automation (ROBT308) - Spring 2015   72

    The scale data (SCL) instruction is used to allow

    very large or very small numbers to be enlarged

    or reduced by the rate value.

    The number 100 stored at the

    source address, N7:0, is multiplied

    by 25,000, divided by 10,000, and

    added to 127.

    The result, 377, is placed in the destination address, N7:1.

  • 8/9/2019 Rob t 308 Lecture 18

    73/78

    Industrial Automation (ROBT308) - Spring 2015   73

    File Arithmetic Operations

  • 8/9/2019 Rob t 308 Lecture 18

    74/78

  • 8/9/2019 Rob t 308 Lecture 18

    75/78

    Industrial Automation (ROBT308) - Spring 2015   75

    The file subtract function of the FAL

    instruction is used to perform subtraction

    operations on multiple words.

  • 8/9/2019 Rob t 308 Lecture 18

    76/78

    Industrial Automation (ROBT308) - Spring 2015   76

    The file multiplication function of the FAL

    instruction is used to perform multiplication

    operations on multiple words.

  • 8/9/2019 Rob t 308 Lecture 18

    77/78

    Industrial Automation (ROBT308) - Spring 2015   77

    The file divide function of the FAL

    instruction is used to perform division

    operations on multiple words.

  • 8/9/2019 Rob t 308 Lecture 18

    78/78