beautypg.com

2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 325

background image

2-289

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

Data C

ont

ro

l I

n

stru

ctio

ns

2

A

V

G

In the following example, the content of CIO 40 is set to #0000 and then incremented by 1 each cycle.

For the first two cycles, AVG(195) moves the content of CIO 40 to D1002 and D1003. The contents of

D1001 will also change (which can be used to confirm that the results of AVG(195) has changed).

On the third and later cycles AVG(195) calculates the average value of the contents of D1002 to

D1004 and writes that average value to D1000.

D1000

0

1

1

2

D1001

1

2

8000

8001

D1002

0

0

0

3

D1003

---

1

1

1

D1004

---

---

2

2

CIO 40

0

1

2

3

1

st

cycle

2

nd

cycle

3

rd

cycle

4

th

cycle

Average

Pointer

3 previous values of IR 40

2 Average

1

@MOV

#0000

40

+

40

#0001

40

AVG

40

#0003

D1000

CLC(41)

0.00

This manual is related to the following products: