Kv -300 – KEYENCE Visual KV Series User Manual
Page 386
9.5 Programming Examples
KV-10/80 Series Only
KV
-300
KV-10/80
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-362
9
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 - (DM0000 ÷ 5 mV)) is calculated when input 0000 is OFF, 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. (As
internal relay 1000 switches ON/OFF at each scan, the output data will be
updated every two scans.)
Example 1: Outputting Analog Voltage (-10 to +10 V)
•
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 0000 is OFF.
2007
#07500
DM0000
DW
0000
#00000
LDA
TM00
STA
#00005
DIV
#02000
ADD
DM0001
STA
DM0001
STA
#02000
LDA
DM0001
SUB
DM0001
STA
DM0000
LDA
0000
1000
1000
1500
#00000
LDA
TM00
STA
#00005
DIV
DM0000
LDA
1000
2800
2008
#02000
LDA
DM0996
STA
1500
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
362