INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

Embed Size (px)

Citation preview

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    1/17

    Data Manipulation Instructions

    Industrial ControlsUniversity of Akron

    OverviewData ManipulationData Transfer

    MOV -- Move

    MVM -- MaskedMoveFAL -- File Arithmeticand Logic

    Data CompareEQU -- Equal

    NEQ -- not EqualGRT -- Greater ThanLES -- Less ThanGEQ -- Greater Than

    or EqualLEQ -- Less Than orEqualLIM -- Limit TestMEQ -- MaskedComparison forEqual

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    2/17

    OverviewData ManipulationNumerical Data I/O InterfaceSet Point Control

    Program FileSystem Program (file 0) This file contains various system

    related information and user-programmed information such as processor type, I/O configuration, processor file name, and password.

    Reserved (file 1) This file is reserved.Main Ladder Program (file 2) This file contains user- programmed instructions defining how the controller is tooperate.Subroutine Ladder Program (file 3-255 1) These files areuser-created and accessed according to subroutine instructionsresiding in the main ladder program file.

    1 999 for PLC-5

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    3/17

    Data FileOutput (file 0) This file stores the state of theoutput terminals for the controller.Input (file 1) This file stores the status of theinput terminals for the controller.Status (file 2) This file stores controller operation information. This file is useful for troubleshooting controller and program operation.

    Bit (file 3) This file is used for internal relaylogic storage.

    Data FileTimer (file 4) This file stores the timer accumulator and preset values and status bits.Counter (file 5) This file stores the counter accumulator and preset values and the status bits.Control (file 6) This file stores the length,

    pointer position, and status bits for specificinstructions such as shift registers and sequencers.Integer (file 7) This file is used to store numericvalues or bit information.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    4/17

    Data FileFloating Point (file 8) This file stores single

    precision non-extended 32-bit numbers. Applies toSLC 5/03 (OS301 and higher), SLC 5/04, andSLC 5/05 processors.String (user-defined file) Applies to SLC 5/03(OS301 and higher), SLC 5/04, and SLC 5/05

    processors.ASCII (user-defined file) Applies to SLC 5/03(OS301 and higher), SLC 5/04, and SLC 5/05

    processors.

    Specifying Logical Addresses

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    5/17

    Specifying Logical Addresses

    Indexed Addressing

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    6/17

    Indexed AddressingMake sure the index value (positive or negative)does not cause the indexed address to exceed thefile type boundary.When an instruction uses more than two indexedaddresses, the processor uses the same index valuefor each indexed address.Set the index word to the offset value you wantimmediately before enabling an instruction thatuses an indexed address.

    Addressing ModesDirect -- Mode used up to nowIndexed -- New addressing modeIndirect -- See math instructionsIndexed Indirect -- Instruction setmanual

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    7/17

    MoveSource is the address or constant of the data youwant to move.

    Destination is theaddress where theinstruction moves the data.Application Note: If youwish to move one word of data without affecting themath flags, use a copy(COP) instruction with alength of 1 word instead of the MOV instruction.

    Flags Effected

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    8/17

    Masked MoveSource is the address of the data you want tomove.Mask is the address of themask through which theinstruction moves data;the mask can be ahexadecimal value(constant).

    Destination is the addresswhere the instructionmoves the data.

    Flags Effected

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    9/17

    MVM Example

    Copy File and Fill FileThe destination file typedetermines the number of wordsthat an instruction transfers.For example, if the destination filetype is a counter and the source filetype is an integer, three integer words are transferred for eachelement in the counter-type file.After a COP or FLL instruction isexecuted, index register S:24 iscleared to zero.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    10/17

    Copy File (COP)

    This instruction copies blocks of data from one location intoanother. It uses no status bits. If you need an enable bit, programan output instruction (OTE) in parallel using an internal bit asthe output address. The following figure shows how fileinstruction data is manipulated.

    Fill File (FLL)This instruction loads elements of a file with either a programconstant or value from an element address. The instruction fillsthe words of a file with a source value. It uses no status bits. If you need an enable bit, program a parallel output that uses a

    storage address. The following figure shows how file instructiondata is manipulated.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    11/17

    Data Compare Instructions

    EqualUse the EQU instruction to testwhether two values are equal.If source A and source B areequal, the instruction islogically true. If these values

    are not equal, the instruction islogically false.Source A must be an address.Source B can either be a

    program constant or a address. Negative integers are stored intwos complementary form.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    12/17

    Not EqualUse the NEQ instruction to testwhether two values are notequal.If source A and source B arenot equal, the instruction islogically true.If the two values are equal, theinstruction is logically false.Source A must be an address.Source B can be either a

    program constant or an address. Negative integers are stored intwos complementary form.

    Less ThanUse the LES instruction to testwhether one value (source A) isless than another (source B).If source A is less than thevalue at source B, theinstruction is logically true.If the value at source A isgreater than or equal to thevalue at source B, theinstruction is logically false.Source A must be an address.Source B can either be a

    program constant or an address. Negative integers are stored intwos complementary form.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    13/17

    Less Than or EqualUse the LEQ instruction to testwhether one value (source A) is lessthan or equal to another (sourceB).If the value at source A is less thanor equal to the value at source B,the instruction is logically true.If the value at source A is greaterthan the value at source B, theinstruction is logically false.Source A must be an address.Source B can either be a programconstant or an address.Negative integers are stored in

    twos complementary form.

    Greater ThanUse the GRT instruction to testwhether one value (source A) isgreater than another (source B).If the value at source A isgreater than the value at sourceB, the instruction is logicallytrue.If the value at source A is lessthan or equal to the value atsource B, the instruction islogically false.Source A must be an address.Source B can either be a

    program constant or an address. Negative integers are stored intwos complementary form.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    14/17

    Greater Than or EqualUse the GEQ instruction to testwhether one value (source A) isgreater than or equal to another (source B).If the value at source A is greater than or equal to the value at sourceB, the instruction is logically true.If the value at source A is less thanthe value at source B, theinstruction is logically false.Source A must be an address.Source B can either be a programconstant or an address.

    Negative integers are stored intwos complementary form.

    Masked Comparison for EqualUse the MEQinstruction to comparedata at a sourceaddress with data at acompare address.Use of this instructionallows portions of thedata to be masked by aseparate word.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    15/17

    MEQ Parameters

    High & Low LimitsCompares Testagainst Low Lim andHigh Lim

    See next few slidesfor discussion of output

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    16/17

    LIM OutputThe Low Limit, Test, and High Limit values can be wordaddresses or constants, restricted to the followingcombinations:

    If the Test parameter is a program constant, both the LowLimit and High Limit parameters must be word addresses.

    If the Test parameter is a word address, the Low Limitand High Limit parameters can be either a program

    constant or a word address.

    Low Limit < Higher LimitIf the Low Limit has a value equal to or less than the HighLimit, the instruction is true when the Test value is between thelimits or is equal to either limit. If the Test value is outside thelimits, the instruction is false, as shown below.

  • 8/14/2019 INSTRUCCIONES de MANIPULACIO Movimiento de Datos y Comparaciones Ingles

    17/17

    Low Limit > High Limit

    If the Low Limit has a value greater than the High Limit, theinstruction is false when the Test value is between the limits. If the Test value is equal to either limit or outside the limits, theinstruction is true, as shown below.