7 measuring analog input average, Kv -300 – KEYENCE Visual KV Series User Manual
Page 350

8.4 Programming
KV-300 Series Only
KV
-300
KV-10/80
Chapter 8 KV-AN6 Analog I/O Module
1-326
8
8.4.7
Measuring Analog Input Average
Measuring Average and Setting Maximum/minimum Value of Analog Input
Example
This program measures the data of analog input ch. 1 of the KV-AN6 module no. 1
under the following conditions.
•
When the data is positive, the average of 100 measurements is written into
DM100 (data value x 100).
•
When the data is negative, the average of 100 measurements is written into
DM101 (data value x 100).
•
Maximum value +6 V
•
Minimum value -6 V
•
Input range ±10 V
•
When analog input exceeds the maximum value, 500 turns ON.
•
When analog input is below the minimum value, 501 turns ON.
Ladder diagram
Sets DM9000.
1003
2009
DM0007
LDA
$8000
CMP
2009
COM
#00001
ADD
#00016
DIV
DM0101
STA
#00016
DIV
DM0100
STA
2008
#09000
DW
DM0000
#19200
DW
DM0001
#46336
DW
DM0002
#00100
DW
DM0003
2003
0001
0002
ITVL
PLS
DM0000
PAUSE
01000
RES
1000
#00020
T000
0500
0500
1001
#00020
T001
T000
0501
0501
#00005
MUL
#00005
MUL
T001
Sets 19200 (+6 V) as the
maximum value.
Sets 46336 (-6 V) as
the minimum value.
Sets 100 as the measure-
ment count at which to
obtain an average.
Special utility relay
2008 initializes
these settings at
startup. (See the
4th parameter
setting of the ITVL
instruction.)
For the ITVL
instruction, refer to
page 3-117.
Input to 001 stops average measurement.
Input to 002 resets average measurement.
When the average of 100 measurements is
positive, the data value x 1000 is written into
DM0100 (+5 V → 5000).
When the average of 100 measurements is
negative, the data value x 1000 is written into
DM0101 (-5 V → 5000).
When analog input exceeds the maximum value,
relay 1000 turns ON for the first scan. Turns ON
0500 for 2 seconds.
When analog input is below the minimum value,
relay 1001 turns ON for the first scan. Turns ON
0501 for 2 seconds.
KVHKA Chap 08.p65
08.3.11, 11:19 AM
326