Kv -300 – KEYENCE Visual KV Series User Manual

Page 391

Advertising
background image

9.5 Programming Examples

KV-10/80 Series Only

KV

-300

KV-10/80

Chapter 9 KV-AD4/DA4 Analog I/O Unit

1-367

1

9

Reference Example When the Input Voltage Exceeds the Expected Range

When the input voltage is 5V or more (DM0992 #3000), #3000 is forcibly written to
the original data (DM0100).

When the input voltage is 1V or less (DM0992 #2200), #2200 is forcibly written to
the original data (DM0100).

1. When the data of DM0992 is greater than #3000, #3000 is written to the original

data (DM0100).

2. When the original data of DM0992 is greater than #2200 but smaller than #3000,

the input data is written to the original data (DM0100) as it is.

3. When the data of DM0992 is smaller than #2200, #2200 is written to the original

data .

4. The data of DM0100 is calculated, and the calculation result ((DM0100 - 2200)) x

5 mV) is written to DM0000.

Note: "2007" (first scan OFF at power ON) must be set as the input condition. In the
case of analog input, an unsteady value will be input for the first scan when the
power is turned ON.

Setting the Minimum and Maximum Voltage Limits and Measuring the
Average Voltage

This sample program sets the minimum and maximum voltage limits to be analog-
input, and measures the average voltage at the 1000th analog input. Averaging
1000 inputs cancels any erroneous input due to electrical noise, etc.

Conditions

Analog input data is input from analog input V0 on the KV-AD4.
(The digital data of data memory DM0992 is used for this operation.)

The accumulated and average values are calculated.

The maximum voltage limit is set to +5 V (#3000). When the maximum voltage
limit is exceeded, output 500 is turned ON for two seconds.

The minimum voltage limit is set to -5 V (#1000). When the minimum voltage limit
is exceeded, output 501 is turned ON for two seconds.

The minimum and maximum measurement values are calculated.

Note: In the following example, A/D-converted digital data is processed. For details
on how to convert the digital data to a voltage value, refer to "Inputting Analog
Voltage (-10 to +10 V) on page 918."

2007 DM0992

LDA

DM0100

LDA

#02200

SUB

#00005

MUL

DM0000

STA

#03000

CMP

DM0992

LDA

#02200

CMP

#03000

LDA

DM0100

STA

2011

#02200

LDA

DM0100

STA

2009

DM0992

LDA

DM0100

STA

2009

1100

2002

1100

1

2

3

4

( )

KVHKA Chap 09.p65

08.3.11, 11:20 AM

367

Advertising