685
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Data Control Instructions
3
AVG
• 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
@MOV
0.00
D1000
1
st
cycle 2
nd
cycle 3
rd
cycle 4
th
cycle
Average
Pointer
3 previous values of IR 40
2 Average
1