beautypg.com

Com: @com:combit inversion), Com: complement com: (bit inversion), Com: @com – KEYENCE Visual KV Series User Manual

Page 195: Complement (bit inversion)

background image

2.4 Instruction Details

1

2

3-171

Chapter 2 Instructions

Example

Coding

Description

Each time input relay 0000 turns from OFF to ON, the contents of DM0000 are
transferred to the internal register. The COM instruction inverts the status of each
bit and transfers the result to DM0001.

Special utility relay 2010 turns ON when the result is "0".

The following shows the case when DM0000 is "$5F5F".

Note:

When an every-scan type COM instruction is used, the status of bits are inverted
every scan time while input relay 0000 is ON.

Use @COM, a differentiation type instruction, to execute the instruction only once
when input relay 0000 turns ON, as shown in the example.

Operands

Key operation

Arithmetic flag

2009

No change

2010

Turns ON when the internal register is "0" after a COM operation. Turns
OFF at other times.

2011

No change

2012

No change

COM:

@COM:

Inverts contents of each bit in internal
register.

@

#,$

FUN

FUN

RES

0

ANB

5

RES

0

ANB

5

COM

COM

Complement

(Bit inversion)

0000

COM

DM0001

STA

DM0000

LDA

Line No.

Instruction

Operand

0000

LD

0000

0001

@LDA

DM0000

0002

CON

0003

@COM

0004

CON

0005

@STA

DM0001

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

DM0001

DM0000

= $5F5F

= $A0A0

1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 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

COM instruction

Bit inversion

0000

DM0000

LDA

COM

DM0001

STA

@

#,$

FUN

FUN

RES

0

ANB

5

ENT

R-SRCH

ENT

R-SRCH

:

:

COM / @COM

KVNKA Chap 02_4dP.p65

08.3.11, 0:03 PM

171