beautypg.com

Application of rra/rla instructions, 4 instruction details, Chapter 2 instructions – KEYENCE Visual KV Series User Manual

Page 194: Sra / @sra / sla / @sla

background image

2.4 Instruction Details

3-170

2

Chapter 2 Instructions

Writes the TM10 data into DM0000, and then writes
#00000 to TM10.

#01

RRA

2002

2002

2009

TM10

STA

#00000

DM0000

TM10

LDA

LDA

TM10

INC

0000

LDA

STA

2002

NEXT

FOR

#00016

Writes the data of 0000 to 0015 into internal register.

Executes FOR-NEXT instruction 16 times.

Shifts the data including carry (2009) to right, and
increments TM10 by 1 when 2009 is ON.

Use @RRA, a differentiation type instruction, to execute the instruction only once
when input relay 0000 turns ON.

Operation using the RLA instruction

When input relay 0001 is ON, the contents of DM0000 are transferred to the internal
register. The contents of the internal register and carry (2009) are rotated counter-
clockwise by the operand value.
In the example above, the contents are rotated counterclockwise every scan time
while input relay 0001 is ON.
Use @RLA, a differentiation type instruction, to execute the instruction only once
when input relay 0001 turns ON.

Note: Special utility relay 2009 may turn ON in accordance with the operation
results; however, it changes immediately when another operation is executed.

Application of RRA/RLA instructions

Error input count
Writes the number of error detection sensors, which are connected to input relays
(0000 to 0015) and turn ON, into DM0000.

Coding

1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0

0

2009

0 1 1 0 0 1 0 0 0 1 1 1 0 0 1 0

0

2009

D

15

D

14

D

13

D

12

D

11

D

10

D

9

D

8

D

7

D

6

D

5

D

4

D

3

D

2

D

1

D

0

D

15

D

14

D

13

D

12

D

11

D

10

D

9

D

8

D

7

D

6

D

5

D

4

D

3

D

2

D

1

D

0

Carry

Carry

1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0

0

2009

1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0

0

2009

D

15

D

14

D

13

D

12

D

11

D

10

D

9

D

8

D

7

D

6

D

5

D

4

D

3

D

2

D

1

D

0

D

15

D

14

D

13

D

12

D

11

D

10

D

9

D

8

D

7

D

6

D

5

D

4

D

3

D

2

D

1

D

0

Carry

Carry

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2002

0009

LD

2002

0001

LDA

0000

0010

LDA

TM10

0002

FOR

#00016

0011

CON

0003

LD

02002

0012

STA

DM0000

0004

RRA

#01

0013

CON

0005

CON

0014

LDA

#00000

0006

AND

2009

0015

CON

0007

INC

TM10

0016

STA

TM10

0008

NEXT

SRA / @SRA / SLA / @SLA

KVNKA Chap 02_4dP.p65

08.3.11, 0:03 PM

170