Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 35 of 55

Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 21 - Move and Logical Instructions

Pages 301 to 308 of 486, from Hand-Held Terminal (Catalog Number 1747-PT1) User Manual

The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1747-PT1

Page 301

Chapter

A–B

21

Move and Logical Instructions This chapter covers output instructions that allow you to perform move and logical operations on individual words. Use these instructions with fixed, SLC 5/01 and SLC 5/02 processors: • Move (MOV) • Masked Move (MVM) • And (AND) • Inclusive Or (OR) • Exclusive Or (XOR) • Not (NOT) All application examples shown are in the HHT zoom display.

Move and Logical Instructions Overview

The following general information applies to move and logical instructions.

Entering Parameters • Source – This is the address of the value on which the logical or move operation is to be performed. It can be a word address or a program constant. If the instruction has two source operands, it will not accept program constants in both operands. • Destination – This is the address of the result of the move or logical operation. It must be a word address.

Indexed Word Addresses With SLC 5/02 processors, you have the option of using indexed word addresses for instruction parameters specifying word addresses. Indexed addressing is discussed in chapter 4.

Using Arithmetic Status Bits After an instruction is executed, the arithmetic status bits in the status file are updated:

• Carry (C), S:0/0 – Set if a carry is generated; otherwise cleared. • Overflow (V), S:0/1 – Indicates that the actual result of a math instruction does not fit in the designated destination. • Zero (Z), S:0/2 – Indicates a 0 value after a math, move or logic instruction. • Sign (S), S:0/3 – Indicates a negative (less than 0) value after a math, move or logic instruction. 21–1

Page 302

Chapter 21 Move and Logical Instructions

Overflow Trap Bit, S:5/0 Minor error bit set upon detection of a mathematical overflow or division by 0. If this bit is set upon execution of the END statement or a TND instruction, a major error will be declared.

Math Register, S:13 and S:14 Move and logical instructions do not affect the math register.

Move (MOV)

Move

MOV

Output Instruction

HHT Ladder Display:

(MOV)

HHT Zoom Display: (online monitor mode)

ZOOM on MOV –(MOV)– NAME: MOVE SOURCE: N7:0 DEST: N7:1

2.3.0.0.2 9760 9760

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: MOV MOVE Source Dest

N7:0 9760 N7:1 9760

The processor moves a copy of the source value to the destination location.

Entering Parameters • Source – a program constant or the address of the data you want to move. • Destination – the address where the instruction moves the data.

21–2

Page 303

Chapter 21 Move and Logical Instructions

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the result is negative (most significant bit is set); otherwise reset Application note: If you wish to move 1 word of data without affecting the math flags, use a copy (COP) instruction with a length of 1 word instead of using the MOV instruction. The COP instruction is discussed in chapter 22.

Masked Move (MVM)

Masked Move

MVM

Output Instruction

HHT Ladder Display:

(MVM)

HHT Zoom Display: (online monitor mode)

ZOOM on MVM –(MVM)– 2.3.0.0.2 NAME: MASKED MOVE SOURCE: B3:6 1111 0100 1111 0101 MASK: 00E0 00E0 DEST: B3:7 0000 0000 1110 0000

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: MVM MASKED MOVE Source B3:6 1111010011110101 Mask 00E0 Dest B3:7 0000000011100000

The masked move instruction is a word instruction that moves a copy of the data from a source location to a destination, and allows portions of the destination data to be masked by a separate word.

21–3

Page 304

Chapter 21 Move and Logical Instructions

Entering Parameters • Source – the address of the data you want to move. • Mask – the address of the mask word through which the instruction moves data. You can also enter a hex value (constant). Refer to appendix B for more information regarding masks and hexadecimal numbering. • Destination – the address where the instruction moves the data.

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the result is negative; otherwise reset

Operation When the rung containing this instruction is true, data at the source address passes through the mask to the destination address. MVM MASKED MOVE Source B3:0 0101010101010101 Mask F0F0 Dest B3:2 1111111111111111

B3:2 before move 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 source B3:0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Mask F0F0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 B3:2 after move 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 unaltered unaltered

Mask (do not pass) data by resetting bits in the mask; pass data by setting bits in the mask. The instruction does not operate unless you set mask bits to pass data you want to use. The bits of the mask can be fixed by a constant value, or you can vary them by assigning the mask a direct address. Bits in the destination that correspond to 0s in the mask are not altered. 21–4

Page 305

Chapter 21 Move and Logical Instructions

And (AND)

And

AND

Output Instruction

HHT Ladder Display:

(AND)

HHT Zoom Display: (online monitor mode)

ZOOM on AND –(AND)– 2.3.0.0.2 NAME: BITWISE AND SOURCE A: B3:6 0001 0001 1101 0111 SOURCE B: B3:7 0000 1001 0010 0100 DEST: B3:8 0000 0001 0000 0100

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: AND BITWISE AND Source A B3:6 0001000111010111 Source B B3:7 0000100100100100 Dest B3:8 0000000100000100

The value at source A is ANDed bit by bit with the value at source B and then stored in the destination. Truth Table: A: Source A bit B: Source B bit R: Destination bit

R = A AND B A

B

R

0 1 0 1

0 0 1 1

0 0 0 1

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the most significant bit is set; otherwise reset

21–5

Page 306

Chapter 21 Move and Logical Instructions

Or (OR)

Or

OR

Output Instruction

HHT Ladder Display:

(OR)

HHT Zoom Display: (online monitor mode)

ZOOM on OR –(OR)– 2.3.0.0.2 NAME: BITWISE INCLUSIVE OR SOURCE A: B3:0 0001 0101 1010 0001 SOURCE B: B3:1 0010 0000 0010 0101 DEST: B3:2 0011 0101 1010 0101

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: OR BITWISE INCLUS OR Source A B3:0 0001010110100001 Source B B3:1 0010000000100101 Dest B3:2 0011010110100101

The value at source A is ORed bit by bit with the value at source B and then stored in the destination. Truth Table: A: Source A bit B: Source B bit R: Destination bit

R = A OR B A

B

R

0 1 0 1

0 0 1 1

0 1 1 1

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the result is negative (most significant bit is set); otherwise reset

21–6

Page 307

Chapter 21 Move and Logical Instructions

Exclusive Or (XOR)

Exclusive Or

XOR

Output Instruction

HHT Ladder Display:

(XOR)

HHT Zoom Display: (online monitor mode)

ZOOM on XOR –(XOR)– 2.3.0.0.2 NAME: BITWISE EXCLUSIVE OR SOURCE A: B3:0 0001 0101 1010 0001 SOURCE B: B3:1 0010 0000 0010 0101 DEST: B3:2 0011 0101 1000 0100

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: XOR BITWISE EXCLUS OR Source A B3:0 0001010110100001 Source B B3:1 0010000000100101 Dest B3:2 0011010110000100

The value at source A is Exclusive ORed bit by bit with the value at source B and then stored in the destination. Truth Table: A: Source A bit B: Source B bit R: Destination bit

R = A XOR B A

B

R

0 1 0 1

0 0 1 1

0 1 1 0

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the result is negative (most significant bit is set); otherwise reset

21–7

Page 308

Chapter 21 Move and Logical Instructions

Not (NOT)

Not

NOT

HHT Ladder Display:

(NOT)

HHT Zoom Display: (online monitor mode)

ZOOM on NOT –(NOT)– NAME: NOT SOURCE: B3:0 DEST: B3:1

Output Instruction

2.3.0.0.2 1010 0110 1110 1100 0101 1001 0001 0011

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: NOT NOT Source B3:0 1010011011101100 Dest B3:1 0101100100010011

The source value is NOTed (inverted) bit by bit and then stored in the destination. Truth Table: A: Source bit R: Destination bit

R = NOT A A

R

0 1

1 0

Using Arithmetic Status Bits C always reset V always reset Z set if the result is zero; otherwise reset S set if the result is negative (most significant bit is set); otherwise reset

21–8