Writing data to be analog-output, Kv -300 – KEYENCE Visual KV Series User Manual

Page 385

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-361

1

9

Writing Data to be Analog-output

This sample program calculates the value of the voltage to be output, and writes the
digital data to the data memory for D/A conversion. Data that has been written to the
data memory for D/A conversion is output as analog data.

Conditions

Data that has been written to DM0000 is converted to digital data for analog
output.

The digital data is sent to analog output V0 on the KV-DA4.
(Digital data is written to data memory DM0996.)

+7.5 V is output when input 0000 is ON.

-7.5 V is output when input 0001 is ON.

Ladder diagram

1. DM0996 is initialized when the power is turned ON.

(That is, #2000 is written to DM0996.)

2. #7500 (7.5 V) is written to DM0000.
3. (DM0000 ÷ 5 mV + 2000) is calculated when input 0000 is ON, and the calcula-

tion result is written to DM0001.

4. (2000 - (DM000 ÷ 5 mV)) is calculated when input 0001 is ON, and the calcula-

tion result is written to DM0001.

5. Before the digital data is written to data memory for D/A conversion, check that

the data is #4095 or less.

Note: An unsteady value will be output if a value outside the range 0 to 4095 is
written to data memory for D/A conversion.

6. The output data will be updated at the rising edge of special utility relay 2800.

2008 #02000

LDA

DM0996

STA

1000

2007 #07500

DM0000

DW

0000 #00000

LDA

TM00

STA

#00005

DIV

#02000

ADD

DM0001

STA

1200

DIFU

DM0100

STA

#02000

LDA

DM0100

SUB

DM0001

STA

1201
DIFU

DM0000

LDA

0001

1000

1200

1201

#00000

LDA

TM00

STA

#00005

DIV

DM0000

LDA

2800

( )

2002

2011

DM0001

LDA

#04095

CMP

DM0001

LDA

DM0996

STA

1

2

3

4

5

6

( )

KVHKA Chap 09.p65

08.3.11, 11:20 AM

361

Advertising