Omron SYSMAC CS Series Instruction & Reference Manual page 635

Hide thumbs Also See for SYSMAC CS Series:
Table of Contents

Advertisement

Function
For the first N–1 cycles when the execution
condition is ON, AVG(195) writes the values of
S in order to words starting with R+2. The
Previous Value Pointer (bits 00 to 07 of R+1)
is incremented each time a value is written.
Until the Nth value is written, the contents of S
will be output unchanged to R and the
Average Value Flag (bit 15 of R+1) will remain
OFF.
When the Nth value is written to R+N+1, the
average of all the values that have been
stored will be computed, the average will be
output to R as an unsigned binary value, and
the Average Value Flag (bit 15 of R+1) will be
turned ON. For all further cycles, the value in
R will be updated for the most current N values
of S.
The maximum value of N is 64. If a value
greater than 64 is specified, operation will use
a value of 64.
The Previous Value Pointer will be reset to 0
after N–1 values have been written.
The average value output to R will be rounded
to the nearest integer.
Precautions
The processing information (R+1) is cleared to 0000 each time the execution condition changes from
OFF to ON.
But the processing information (R+1) will not be cleared to 0000 the first time the program is executed
at the start of operation. If AVG(195) is to be executed in the first program scan, clear the First Work
Area Word from the program.
Example Programming
When CIO 0.00 is ON in the following example, the contents of D100 will be stored one time each scan
for the number of scans specified in D200. The contents will be stored in order in the ten words from
CIO 302 to CIO 311. The average of the contents of these ten words will be placed in CIO 300 and then
bit 15 of CIO 301 will be turned ON.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
S: Source word
N: Number of cycles
R
Pointer
R+1
Average Valid Flag
R+2
S
Cycle 1
R+3
S
Cycle 2
S
Cycle N
R+N+1
3. Instructions
Average
3
N values
601

Advertisement

Table of Contents
loading

Table of Contents