Вы находитесь на странице: 1из 132

Chapter 7

KV-L2 Serial Interface Module


This chapter describes the serial interface modules for KV-300 Series.
7.1 Outline ........................................................................................ 1-240
7.1.1 Features ................................................................................................... 1-240
7.2 Configuration ............................................................................. 1-241
7.2.1 Parts and Functions ................................................................................. 1-241
7.2.2 System Configuration ............................................................................... 1-242
7.2.3 Outline of Operation Modes ..................................................................... 1-244
7.3 Installation .................................................................................. 1-245
7.3.1 Setting the Operation Mode ..................................................................... 1-245
7.3.2 Communications Protocols ...................................................................... 1-247
7.3.3 Connector Wiring ..................................................................................... 1-248
7.3.4 Connecting to External Units.................................................................... 1-249
7.4 Software Setup ........................................................................... 1-252
7.4.1 Using KV Software [KV IncrediWare (DOS)] ............................................ 1-252
7.5 KV Mode Programming ............................................................. 1-253
7.5.1 Operating in KV Mode .............................................................................. 1-253
7.5.2 Serial Communications Procedure........................................................... 1-255
7.5.3 Transmission and Reception of Text Data ............................................... 1-262
7.6 Display Interface Mode Programming ..................................... 1-270
7.6.1 Operating in Display Interface Mode ........................................................ 1-270
7.6.2 Command and Response Format ............................................................ 1-273
7.6.3 Commands and Responses ..................................................................... 1-275
7.7 Non-procedure Mode Programming ........................................ 1-292
7.7.1 Operating in Non-procedure Mode........................................................... 1-292
7.7.2 Assignment of Relay Nos. and Data Memory Address Nos. .................... 1-294
7.7.3 Transmitting Text Data ............................................................................. 1-297
7.7.4 Receiving Text Data ................................................................................. 1-298
7.7.5 ASCII code/Binary Conversion Function .................................................. 1-300
7.8 Troubleshooting Guide ............................................................. 1-304
7.8.1 Troubleshooting ....................................................................................... 1-304
7.8.2 Precautions .............................................................................................. 1-305
7.9 Specifications ............................................................................ 1-306
7.9.1 Specifications ........................................................................................... 1-306
7.9.2 Dimensions .............................................................................................. 1-307
7.10 Command List ............................................................................ 1-308
7.10.1 List of Commands and Responses .......................................................... 1-308
7.10.2 List of Commands and Responses in Display Interface mode................. 1-309
KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
7.2 Configuration KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-240
7
7.1 Outline
7.1.1 Features
The KV-L2 Serial Interface Module is an interface module that controls communica-
tions between the KV-300 CPU and external units such as personal computers. It
has the following features.
Includes RS-232C and RS-422A communications ports.
The RS-232C port has a D-SUB 25-pin type. The other port, located on the terminal
block, is switchable between RS-422A and RS-232C.
Monitors operation status of the KV-300 CPU.
The KV-L2 monitors the operation status of the KV-300 CPU by reading the values
of data memory, relay contacts, counters, and timers from the KV-300 CPU.
Uploads and downloads Ladder programs.
Ladder programs can be transferred with the KV Ladder programming software (Ver.
2).
Allows 1:n connections.
Up to ten KV-300 CPUs can be connected to a single personal computer through
the KV-L2, allowing multi-drop connections. Multi-drop connections between KV-300
CPUs are also supported (in non-procedure mode).
Data can be fetched from external units.
Text data can be read into the KV-300 CPU data memory.
Allows direct connection of a display using a Host-Link protocol.
7.2 Configuration
K
V
-
3
0
0
K
V
-
1
0
/
8
0
KV-300 Series Only
Chapter 7 KV-L2 Serial Interface Module
1-241
1
7
7.2 Configuration
7.2.1 Parts and Functions
1 POWER indicator
2 Port 1 operation
indicator
3 Port 2 operation
indicator
4 Port 1 (RS-232C)
5 Connector to other
modules
6 Port 2
(RS-232C/RS-422A
switchable)
7 Port 2 interface selection switch
8 Terminator selection switch
9 Communications mode setting switch
0 Communications protocol setting switch
A Station no.
setting dial
B Connector to
other modules
1 POWER indicator
Lights when the power supply turns
ON.
2 Port 1 operation indicator
Indicates communication status.
During communication:
Green: Transmission
Red: Reception
Yellow: Transmission and reception
OFF: Communication disabled
3 Port 2 operation indicator
Indicates communication status.
During communication:
Green: Transmission
Red: Reception
Yellow: Transmission and reception
OFF: Communication disabled
4 Port 1 (RS-232C)
Port for RS-232C communications.
5 Connector to other modules
For connection to a KV-300 CPU or
external unit.
6 Port 2 (RS-232C/RS-422A)
Switchable between RS-232C and
RS-422A.
7 Port 2 selection switch
For switching between RS-232C
or RS-422 communications
modes.
8 Terminator selection switch
For terminating the modules at the
rightmost and leftmost ends of an
RS-422A connection.
9 Communications mode setting
switch
For setting the operation mode of
the KV-L2.
0 Communications protocol setting
switch
For setting the transmission rate,
data bit, parity, and stop bit.
A Station no. setting dial
For setting the station no. in the
1:n connection sequence.
7.2 Configuration KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-242
7
7.2.2 System Configuration
The following examples show KV-L2 system configurations in 1:1 and 1:n connec-
tion patterns. These examples also highlight the functional differences between
these connection patterns.
Connection to the KV-300 CPU
A maximum of two KV-L2s can be connected to the KV-300 CPU. The KV-L2s
should be installed at the right end of a system.
1:1 connection
Connect the KV-L2 to an external unit (such as a personal computer) through the
RS-232C or RS-422A ports.
Note: Use RS-232C communications for connections of up to 15 meters; use RS-
422A communications for connections of up to 500 meters.
1:n connection
Up to 10 KV-L2 modules can be connected to an external unit (such as a personal
computer) through the RS-422A port.
KV-U4 KV-300 KV-L2 KV-L2
7.2 Configuration
K
V
-
3
0
0
K
V
-
1
0
/
8
0
KV-300 Series Only
Chapter 7 KV-L2 Serial Interface Module
1-243
1
7
2:1 connection
The KV-L2 can be connected simultaneously to a personal computer and a display
through ports 1 and 2.
2:n connection
Multiple KV-L2 modules can be connected to an external unit (such as a personal
computer) using a multi-drop connection pattern through the RS-422A port. Mul-
tiple KV-L2 modules can themselves be interconnected to another external unit
(such as a display) through the RS-232C port.
7.2 Configuration KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-244
7
7.2.3 Outline of Operation Modes
The KV-L2 has three operation modes. The desired mode can be set with the DIP
switch.
KV mode
In KV mode, the KV-L2 permits serial communications and transmission/reception of
text data through the KV-300 CPU modular jack.
Through a connected PC, the statuses of the KV-300 can be monitored, stored data
can be read or updated, and data can be fetched from an external unit.
The data to be fetched from the external unit must have STX and ETX as separa-
tors.
Refer to "7.5.1 Operating in KV Mode" on page 1-253.
Display Interface mode
In display interface mode, the KV-L2 can control the KV-300 when used with
displays. Also, a connected personal computer can be used to monitor the KV-300
statuses and read or update stored data.
Refer to "7.6.1 Operating in Display Interface Mode" on page 1-270.
Non-procedure mode
In non-procedure mode, the KV-L2 allows transmission/reception of text data. The
data does not require STX and ETX separators, but does require CR or CRLF
separators.
Refer to "7.7.1 Operating in Non-procedure Mode" on page 1-292.
MT-400
External display devices
PC
RD, RV3
KV mode/Display interface mode
Display interface mode
KV mode/non-
procedure mode
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-245
1
7
7.3 Installation
7.3.1 Setting the Operation Mode
Setting the operation mode
Turn off the power switch before setting the operation mode. Use the operation
mode setting switches A1 to A4 (SET A). A1 and A2 control the mode for port 1, and
A3 and A4 control the mode for port 2. (Ports 1 and 2 can be set independently.)
Setting port 2
Set port 2 to either RS-232C or RS-422A modes.
If port 2 is set to RS-232C mode and is connected to an external unit set to
RS-422A mode, the connected unit may be damaged.
When setting port 2 to RS-232C mode, set the TERMINATOR (terminal
resistor) to OFF.
Port 1 Port 2
A1 A2 A3 A4
KV mode OFF OFF OFF OFF
Display Interface mode OFF ON OFF ON
Non-procedure mode ON ON ON ON
Communication mode setting switch
(A1 to A4 are factory-set to OFF.)
Port 2 interface selection switch
422A 232C
INTERFACE
RS-422A: Set the switch to the left (422A)*1.
RS-232C: Set the switch to the right (232C).
*1 When setting port 2 to RS-422A, set the TERMINA-
TOR (terminal resistor) to ON. (Refer to Setting the
TERMINATOR on the next page.)
CAUTION
ON
OFF
A1 A2 A3 A4
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-246
7
Setting the TERMINATOR (terminal resistor)
Turn off the power switch before setting the TERMINATOR switch.
When using the RS-422A communications mode, set the TERMINATOR selection
switches of the KV-L2s at both ends of the connection cable to ON.
Set the TERMINATOR selection switches of any KV-L2s connected between the
leftmost and rightmost KV-L2s to OFF. If set to ON, normal communications will not
take place.
Note: When setting port 2 to RS-232C mode, set the TERMINATOR selection
switch to OFF.
Setting the station no.
When the RS-422A communications mode has been selected, a station no. must be
assigned to each KV-L2 to establish which KV-L2 is to communicate with the
external unit (personal computer). Turn off the power switch before setting the
station no.
Note 1: When the KV-L2 is set to RS-422A communications mode, set the TERMI-
NATOR (terminal resistor) to ON.
Note 2: Set the terminators of the modules connected in intermediate positions
(between the leftmost and rightmost KV-L2s) to OFF.
Note 3: Do not assign the same station no. to more than one module; otherwise,
data communication will be disrupted.
Station no. setting dial
F
E
D
C
B
A
9 8
7
6
5
4
3
2
1
0
Set the station no. to a number within the range 0 to 9.
Do not assign the same station no. to more than one
KV-L2 module. The module is factory-set to 0.
TERMINATOR selection switch
ON OFF
TERMINATOR
Termination required: Set the switch to
the left (ON) position.
No termination required: Set the switch
to the right (OFF) position.
* *
In the figure above, only those KV-L2s marked with an
asterisk require their TERMINATOR switches set to ON.
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-247
1
7
7.3.2 Communications Protocols
This section describes the use of the communications protocol setting switch (SET
B).
Setting communications protocols
Set the baud rate, data bit, parity, and stop bit with the SET B DIP switch.
Before setting the switch, set the power switch to OFF.
Communications protocol setting switch
B1 B2 B3 B4 B5 B6 B7 B8
Baud rate 1200 bits/s OFF OFF OFF OFF
2400 bits/s ON OFF OFF OFF
4800 bits/s OFF ON OFF OFF
9600 bits/s ON ON OFF OFF
19200 bits/s OFF OFF ON OFF
31250 bits/s ON OFF ON OFF
38400 bits/s OFF ON ON OFF
Setting disabled ON ON ON OFF
Parameters Data bits 7 bits OFF OFF
8 bits ON OFF
Parity None OFF OFF OFF
Odd ON OFF OFF
Even ON ON OFF
Stop bit 1 bit OFF OFF
2 bits ON OFF
ON
OFF
B1 B2 B3 B4 B5 B6 B7 B8
B1 to B7 are factory-set to OFF.
Note 1: Communications protocols for the modules to be connected must be
identical; otherwise, communication will fail.
Note 2: The communications protocols settings apply to both ports 1 and 2.
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-248
7
7.3.3 Connector Wiring
Wiring RS-232C cables
D-Sub 25-pin connector
Terminal block
Wiring RS-422A cables
Note: Do not short-circuit the SG terminal with any other signal terminal. Doing so
may cause failure of the unit.
Recommended communications cable (for use with RS-422A)
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
Unit designated
as DCE
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
Unit designated
as DTE
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
D-Sub 25-pin
connector
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
3
5
1
SD
RD
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
3
5
1
SD
RD
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
Unit designated
as DTE
Unit designated
as DCE
KV-L2 terminal nos.
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
2
5
4
1
SDA
SDB
RDA
RDB
SG
SDA
SDB
RDA
RDB
SG
KV-L2 External unit
Item Specification
Cable type Shielded cable
Logarithm 3P
Maximum conductor resistance at 20C (68F) 88.0 /km
Maximum insulation resistance 10.000 Mkm
Withstand voltage 500 VDC for 1 min
Maximum electrostatic capacity (1 kHz) 60 nF/km on average
Characteristic impedance (100 kHz) 110 10
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-249
1
7
7.3.4 Connecting to External Units
Connecting to An External Display
Connect the KV-L2 to the external displays through the RS-232C port. Set the KV-
L2 to Display Interface mode.
Use the serial interface equivalent to the Host Link protocol.
When using port 1
Use optional connection cable OP-90906.
When using port 2 (set to RS-232C mode)
Use optional connection cable OP-20302.
Connecting to an IBM PC-AT Computer
When connecting the KV-L2 to an IBM PC-AT computer, use either RS-232C or RS-
422A mode. To connect through RS-422A mode, the PC must have an RS-422A
interface.
Set the KV-L2 to either KV, Display interface , or non-procedure modes.
When using port 1
An RS-232C cable is required. The following figure shows the wiring connections.
When using port 2 (set to RS-232C mode)
The following figure shows the wiring connections.
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
1
2
3
4
5
6
7
SD
RD
SG
SD
RD
RS
CS
DR
SG
Black
Display
8
9
3
5
1
Brown
Blue
5
4
3
2
1
9
8
7
6
D-Sub 9-pin connector
KV-L2 terminal nos.
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
2
3
4
5
6
20
7
SD
RD
SG
SD
RD
RS
CS
DR
ER
SG
KV-L2 PC
3
5
1
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
3
4
5
7
2
3
4
5
6
20
7
SD
RD
RS
CS
SG
SD
RD
RS
CS
DR
ER
SG
KV-L2 PC
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
51
2
3
4
5
6
7
1
2
3
4
5
6
7
SD
RD
RS
CS
SG
SD
RD
RS
CS
SG
8 8
9 9
KV-L2 Display
5
4
3
2
1
9
8
7
6
D-Sub 9-pin connector
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-250
7
When using port 2 (set to RS-422A mode)
The following figure shows the wiring connections.
When connecting multiple KV-L2s through port 2 (set to RS-422A mode)
The following figure shows the wiring connections. The PC serves as the master
unit.
Connecting to the KV-10/16/24/40/80
Connect the KV-L2 to the KV-10/16/24/40/80 through the RS-232C port.
Set the KV-L2 to non-procedure mode.
When using port 1
Use the optional connection cable (OP-96368) and a D-Sub 25-pin connector (OP-
96369) to connect the KV-L2 to the RS-232C connector.
When using port 2 (set to RS-232C mode)
The following figure shows the wiring connections.
Connecting KV-L2s
KV-L2s can be connected either through RS-232C or RS-422A connections. Set the
KV-L2s to either KV or non-procedure modes.
When using port 1 (1:1 connection)
Use an RS-232C cable. The following figure shows the wiring connections.
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
5
4
SD
RD
SG
SD
RD
KV-L2 KV CPU
SG
3
5
1
5 4 3 2
KV CPU pin nos.
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
3
4
5
7
2
3
4
5
7
SD
RD
RS
CS
SG
SD
RD
RS
CS
SG
KV-L2 KV-L2
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
SDA
SDB
RDA
RDB
SG
SDA
SDB
RDA
RDB
SG
KV-L2 PC
3
2
5
4
1
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
2
5
4
1
SDA(3)
SDB(2)
RDA(5)
RDB(4)
SG(1)
SDA
SDB
RDA
RDB
SG
KV-L2 KV-L2
SDA
SDB
RDA
RDB
SG
PC
2
3
4
5
7
3
5
4
SD
RD
RS
CS
SG
SD
RD
SG
KV-L2 KV CPU
5 4 3 2
D-Sub 25-pin connector
(OP-96369)
Connection cable
(OP-96368)
KV CPU pin nos.
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
7.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-251
1
7
When using port 2 (set to RS-232C mode)
The following figure shows the wiring connections.
When using port 2 (set to RS-422A mode)
The following figure shows the wiring connections.
When using port 2 to connect multiple KV-L2s (set to RS-422A mode)
The following figure shows the wiring connections.
The KV-L2 at the left end is the master module.
3
2
5
4
1
SDA(3)
SDB(2)
RDA(5)
RDB(4)
SG(1)
SDA
SDB
RDA
RDB
SG
KV-L2 KV-L2
SDA
SDB
RDA
RDB
SG
KV-L2
3
2
5
4
1
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
2
5
4
1
SDA
SDB
RDA
RDB
SG
SDA
SDB
RDA
RDB
SG
KV-L2 KV-L2
3
2
5
4
1
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
5
1
3
5
1
SD
RD
SG
SD
RD
SG
KV-L2 KV-L2
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
7.4 Software Setup KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-252
7
7.4 Software Setup
7.4.1 Using KV Software [KV IncrediWare (DOS)]
Starting KV IncrediWare (DOS) from the KV-L2
A personal computer, when connected to the KV-L2 of the designated station no.,
can transfer programs to multiple KV-300 CPUs and monitor their operations. To
use this function, change the environmental string as follows before starting the KV
IncrediWare (DOS).
SET KV-LNK=Y
By substituting Y with 0 or 1 to F, your personal computer can communicate with
KV-300 CPUs through the designated KV-L2 without requiring selection of the KV-
L2 station no.
Example
Starting KV IncrediWare (DOS)
C>SET KV-LNK=Y ENTER
C>MNU ENTER
Example
Starting KV IncrediWare (DOS) by using KV-L2 designated as station no.1
C>SET KV-LNK=1
C>MNU
Note: When KV-LNK is set to "Y", the KV IncrediWare (DOS) confirms the station
no. to be accessed whenever communication* is attempted. This permits frequent
changing of the station no. However, if KV-LNK is set to "1", for example, you can
change the station no. only after quitting KV IncrediWare (DOS) and resetting KV-
LNK to the desired number.
* "PC-Port" in the menu refers to the serial port on the KV-300 CPU, which is used
only for communication between the CPU and a computer. Ignore the L2 function
when using this port.
Setting the KV-L2 (in KV mode)
Set the KV-L2 station no. as follows.
Connect the personal computer to the KV-L2 using an RS-232C cable. Set the KV-
L2 connected to the personal computer station no. F. Connect the KV-L2 of station
no. F to other KV-L2s using the multi-drop method with RS-422A cables. Specify
station nos. 0 to 9 of the other KV-L2s.
Note: Use the station no. designated by the station no. selection switch on the KV-
L2.
PC
RS-232C
First KV-300 system
KV-L2
Station no. F
RS-422A
Second KV-300 system
KV-L2
Station nos. 0 to 9
RS-422A
Third KV-300 system
KV-L2
Station nos. 0 to 9
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-253
1
7
7.5 KV Mode Programming
7.5.1 Operating in KV Mode
Communications protocol
In KV mode, the KV-L2 operates in the same manner as a KV-300 CPU performing
communications. Set the communications protocol to KV mode and connect the KV-
L2 to external units as described below.
Setting the operation mode
Set the operation mode using the operation mode setting switch SET A (A1 to A4).
Use A1 and A2 to set the mode for port 1, and A3 and A4 to set the mode for port 2.
Turn off the power switch before setting the operation mode.
Communications protocol
This table shows the communications protocol for KV mode. Refer to this table when
setting the communications parameters of the external unit to be connected.
When setting the external unit to be connected, refer to the instruction manual
supplied with the unit.
When the module is set to KV mode, the communications protocol specified by the
communications protocol setting switch SET B is invalid.
Connecting to the KV-L2
I When using port 1
When connecting the KV-L2 to an external unit with an RS-232C port, connect the
RS-232C cable as shown in the following figures. Alternatively, use either a stan-
dard or null modem RS-232C connection cable (optional) to port 1 (RS-232C).
ON
OFF
A1 A2 A3 A4
Operation mode Port 1 Port 2
A1 A2 A3 A4
KV mode OFF OFF OFF OFF
Display Interface mode OFF ON OFF ON
Non-procedure mode ON ON ON ON
Duplex Full
Synchronization Start/stop
Data format ASCII
Baud rate 9600 bits/s
Data length 8 bits
Parity check Even
Stop bit length 1 bit
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DTE
External unit
designated as DCE
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-254
7
I When using port 2 (set to RS-232C mode)
When using an RS-232C port on the KV-L2, connect the cables as shown.
I When using port 2 (set to RS-422A mode)
When using the RS-422A port on the KV-L2, connect the cables as shown.
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
5
1
SD
RD
SG
KV-L2
3
5
1
SD
RD
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DTE
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DCE
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
SDA
SDB
RDA
RDB
SG
SDA
SDB
RDA
RDB
SG
KV-L2 External unit
3
2
5
4
1
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-255
1
7
7.5.2 Serial Communications Procedure
The KV-L2 can be connected to a personal computer to read the current values and
set values of the counters and timers or the data memory values into the PC from
the KV-300 CPU for checking or updating.
Command transmission procedure
Commands are transmitted from a personal computer to the KV-L2 as follows:
Break signal
Upon receiving a break signal, the KV-L2 initializes its own communications buffer
and baud rate. The break signal should be transmitted only once before communica-
tion is initiated. The break signal need not be transmitted once communication is
successful.
The break signal must have the waveform shown below.
Note: Transmit the break signal for the first communication with a personal com-
puter after the KV IncrediWare (DOS) has been activated through a KV-L2 or KV-
P3E.
If transmission of the break signal fails, turn OFF the KV-300 CPU power switch to
initialize the communications program. Then begin communicating with the personal
computer.
Command
Response
KV-300
CPU
KV-L2 PC
Initializes communications
program in the KV-300 CPU.
1
2
3
4
5
Transmits a break signal (100 ms or longer)
Transmits communication start command (CR)
Transmits a command
Receives a response
Transmits communication end command (CQ)
Starts communications with the
KV-300 CPU.
Transmits a command that
instructs the KV-300 CPU to
perform a required operation.
Checks a response to the
required operation.
Terminates communication
with the KV-300 CPU.
+V
-V
SD
100 ms min.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-256
7
Command and response
"Command" and "response" in communications between the KV-L2 and a personal
computer are defined as follows:
Command:
Message transmitted from a personal computer to the KV-L2
Response:
Response to the command transmitted from the KV-L2 to the personal computer
When a command is transmitted from the personal computer to the KV-L2, the KV-
L2 sends a response to the personal computer. When writing a program to be
controlled by the personal computer, be sure that the response from the KV-L2 is
confirmed before the next command is transmitted.
Command/response format
Command/response formats are as follows:
The personal computer transmits a command to the KV-L2 according to the com-
mand format. The KV-L2 recognizes CR as delimiter, and thus ignores the LF in the
CR LF command and identifies the subsequent characters as the command.
The KV-L2 returns a response to the command according to the response format.
When writing a program with a personal computer, verify that the response can be
handled according to the response format.
When the 1:n connection pattern is used, the personal computer communicates only
with the KV-L2 set to the specified station no. To communicate with a KV-L2 set to
another station no., terminate communications with the KV-L2 set to the specified
station no. and send a communication start command (CR_nn) in which the new
station no. is specified in "nn."
Communications commands and responses
Communications command/response list
Command format
Command
C
R
C
R
L
F
Command
or
Response
C
R
L
F
Response format
Function Command Response Remarks
Starts communi- CR_nn CC_nn nn = Station no. (00 to 09, 15)
cations Specify in decimal value
(not required for 1:1 connection)
Ends communi- CQ CF
cations
Changes mode Mn OK n=0: PROGRAM mode
of KV-300 CPU n=1: RUN mode
Error clear mode ER OK
Checks CPU error ?E dd dd: Error code (No error: 00)
Inquires model ?K K300
Checks current ?M 0 O: PROGRAM mode
mode 1 1: RUN mode
Reads counter RD_Cnnn f,ddddd,ddddd f=0, 1 0: contact OFF 1: contact
RD_CTHn (current value) ON ddddd=00000 to 65535
RD_CTCn (preset value) (in decimal) n/nnn=counter no.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-257
1
7
Function Command Response Remarks
Reads timer RD_Tnnn f,ddddd,ddddd f=0, 1 0: contact OFF
(current value) ddddd=00000 to 65535)
(preset value) (in decimal nnnn=timer no.
Reads analog RD_AT ddddd_ddddd_ ddddd=00000 to 00249
timer 00000_00000 (in decimal)
(Trimmer 0) Reads values of trimmers 0 and
(Trimmer 1) 1.
Changes current WR_Cnnn_ OK n/nnn: counter/timer no.
value of timer/ ddddd ddddd=00000 to 65535
counter WR_CTHn_ (in decimal)
ddddd
WR_Tnnn_
ddddd
Changes preset WS_Cnnn_ OK n/nnn: counter/timer no.
value of timer/ ddddd ddddd=00000 to 65535
counter WS_CTCn_ (in decimal)
ddddd
WS_Tnnn_
ddddd
Reads relay RD_nnnnn 0 0: contact OFF
contact 1 1: contact ON
Forces contact ON ST_nnnnn OK nnnnn=relay no.
ST_Cnnn nnn=counter /timer no.
ST_Tnnn
Forced contact OFF RS_nnnnn OK nnnnn=relay no.
RS_Cnnn nnn=counter /timer no.
RS_CTCn n=high-speed counter comparator
RS_Tnnn no.
Reads DM RD_DMnnnn ddddd ddddd=00000 to 65535
(in decimal)
nnnn=DM no.
Writes into DM WR_DMnnnn_ OK ddddd=00000 to 65535
ddddd (in decimal)
nnnn=DM no.
Reads TM RD_TMnn ddddd ddddd=00000 to 65535
(in decimal)
nn=TM no.
Writes into TM WR_TMnn_ OK ddddd=00000 to 65535
ddddd (in decimal)
nn=TM no.
An underscore (_) in the command represents a space.
TM30 and TM31 are read-only memories; values cannot be written to them.
Note: The "WS" command changes the content of the program stored in the PLC's
EEPROM. Contact Keyence if you need to change it frequently.
Communications commands
This section describes the commands used for communications between the KV-L2
and a personal computer, and the responses from the KV-L2 in normal operation.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-258
7
I Communications start command
Initiates communications between the KV-L2 and a personal computer.
Command: CR_nn [nn = Station no. (not required for 1:1 connection)]
Response: CC_nn
I Communications end command
Terminates communications between the KV-L2 and a personal computer.
Command: CQ
Response: CF
I Mode change command
Switches the KV-300 CPU mode between PROGRAM and RUN.
Command: Mn [n=0: PROGRAM mode, n=1: RUN mode]
Response: OK
I Clears error messages on the KV-300 CPU.
Command: ER
Response: OK
I Checking CPU error
The KV-300 CPU responds with error codes indicating errors or faults in the KV-300
CPU.
Command: ?E
Response: dd [dd: error code]
(Refer to P. 115 for error code list.)
I Inquiring model
The KV-300 CPU responds with the model no. of the KV-300 module currently in
use.
Command: ?K
Response: K300 (When KV-300 CPU is in use.)
I Checking current mode
The KV-300 CPU responds with 0 or 1, indicating the current mode.
Command: ?M
Response: 0, 1 [0: PROGRAM mode, 1: RUN mode]
I Reading counter
Reads contact ON/OFF status and current and preset values of the specified
counter.
Command: RD_Cnnn [nnn = counter no.] Reads the content of a counter or
an up/down counter.
RD_CTHn [n = high-speed counter no.] Reads the content of a
high-speed counter CTH.
RD_CTCn [n = high-speed counter comparator no.] Reads the
content of a high-speed counter comparator.
Response: f,ddddd,ddddd [f = 0, 1: ON/OFF status of counter contact
(current value) 0: OFF, 1: ON]
(preset value) [ddddd = 00000 to 65535 (in decimal)
I Reading timer
Reads contact ON/OFF status and current and preset values of the specified timer.
Command: RD_Tnnn [nnn = timer no.]
Response: f,ddddd,ddddd [f=0, 1: ON/OFF status of a timer contact
(current value) 0: OFF, 1: ON]
(preset value) [ddddd = 00000 to 65535 (in decimal)]
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-259
1
7
I Reading analog timer
Reads trimmer setting of analog timer.
Command: RD_AT
Response: ddddd_ddddd_ [ddddd = 00000 to 00249 (in decimal)]
00000_00000
Setting of trimmer 1 (00000 to 00249)
Setting of trimmer 0 (00000 to 00249)
An underscore (_) in the command represents a space.
I Changing current value of timer/counter
Changes current value of the specified timer/counter.
Command: WR_Cnnn_ddddd Changes current value of a counter or an
up-down counter.
Command: WR_Tnnn_ddddd Changes current value of a timer.
WR_CTHn_ddddd Changes current value of a high-speed counter
CTH.
[nnn = counter/timer no. n = high-speed
counter no.]
[ddddd = 00000 to 65535 (in decimal)]
Response: OK
I Changing preset value of timer/counter
Changes preset value of the specified timer/counter.
Command: WS_Cnnn_ddddd Changes preset value of a counter or an
up-down counter.
WS_Tnnn_ddddd Changes preset value of a timer
WS_CTCn_ddddd Changes preset value of a high-speed counter
comparator CTC.
[nnn = counter/timer no.]
[n = high-speed counter comparator no.]
[ddddd = 00000 to 65535 (in decimal)]
Response: OK
Note: The "WS" command changes the content of the program stored in the PLC's
EEPROM. Contact Keyence if you need to change it frequently.
I Reading relay contact
Reads contact ON/OFF status of the specified relay.
Command: RD_nnnnn [nnnnn: relay no.]
Response: 0, 1 [0 = OFF, 1 = ON]
I Forcing contact ON
Forces ON the contact of a specified relay, counter, or timer.
Command: ST_nnnnn [nnnnn = relay no.]: Forces ON a contact of a relay.
ST_Cnnn [nnn = counter no.]: Forces ON a contact of a counter.
ST_Tnnn [nnn = timer no.]: Forces ON a contact of a timer.
Response: OK
I Forcing contact OFF
Forces OFF the contact of a specified relay, counter, or timer.
Command: RS_nnnnn [nnnnn = relay no.]: Forces OFF a contact of a relay
[nnn = counter no.]: Forces OFF a contact of a
counter.
RS_Tnnn [nnn = timer no.]: Forces OFF a contact of a timer.
RS_CTCn [n = high-speed counter comparator no.]: Forces OFF
a contact of a high-speed counter comparator.
Response: OK
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-260
7
Reading DM
Reads content of the specified data memory address.
Command: RD_DMnnnn [nnnn = data memory no.]
Response: ddddd [ddddd = 00000 to 65535 (in decimal)]
I Writing into DM
Writes values into the specified data memory address.
Command: WR_DMnnnn_ [nnnn = data memory no.]
ddddd [ddddd = 00000 to 65535 (in decimal)]
Response: OK
I Reading TM
Reads content of the specified temporary memory address.
Command: RD_TMnn [nn = 00 to 31 (temporary memory no.)]
Response: ddddd [ddddd = 00000 to 65535 (in decimal)]
I Writing into TM
Writes values into the specified temporary memory address.
Command: WR_TMnn_ddddd [nn=00 to 29 (temporary memory no.)]
[ddddd = 00000 to 65535 (in decimal)]
Response: OK
An underscore (_) in the command represents a space.
Other response codes
The KV-L2 returns a response corresponding to the command transmitted by the
computer. If the command from the computer is an unspecified one, or if an error
occurs in the KV-300 CPU, the KV-L2 issues an appropriate response code for the
status.
The following table summarizes the description, cause, and remedy for a response
code.
I Response
Code Description Cause Remedy
E0 Relay no.
error
Undefined relay, counter,
timer, DM, CTH, or CTC
number was specified.
Counter, timer, CTH or CTC
number not used in a pro-
gram was specified.
Undefined or inconnect
command was transmitted.
Specify a number that is
defined in the KV-300 CPU
being used.
Check the program, and
specify a number used in
the program.
Transmit the connect
command.
E1 Command
error
Undefined or incorrect
command was transmitted.
Command other than "CR"
was transmitted before the
communications path was
established.
Transmit the correct com-
mand.
Transmit "CR" to initiate
communications, then
transmit the command.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-261
1
7
E2 Program
unregis-
tered
"M1" was transmitted with no
program stored in the KV-300
CPU.
Reading of timer/counter was
attempted.
Register a program into the
KV-300 CPU.
Check the program for the
timer/counter number being
used and specify it.
E3 CPU fault Hardware error was detected
in a KV-300 CPU.
Turn the power to the KV-300
OFF and then ON again. If
the cause of the error is not
corrected, the CPU may be
faulty. Contact your nearest
KEYENCE office.
E4 Write-
protected
Attempt was made to change
the preset value of a counter,
timer, or CTC in a write-
protected program.
Write-enable the program,
and change the preset value.
E5 CPU error "M1" was transmitted before
an error message was
cleared from the KV-300.
Clear the error message from
the KV-300 CPU, and remove
the cause of the error.
Error code list
Error codes included in responses to the KV-300 CPU error check command (?E)
as well as error descriptions, causes of error, and remedies are listed below.
Error
Code Description Cause Remedy
00 No error
10 CALL nest
error
Subroutines are nested to four
levels or more.
These errors may occur when
a program is executed. Check
the program while paying
particular attention to usage of
subroutines and the INT
instruction, and restore the
program accordingly.
11 FOR nest
erro
FOR-NEXT instructions are
nested to eight levels or more.
12 INT nest
error
Five levels or more of inter-
rupts occurred simultaneously.
13 MPS nest
error
MPS/MPP instructions are
nested to eight levels or more.
20 Memory
erased
Contents of RAM are erased.
All data in data memory and
current values of counters in
the KV-300 CPU are cleared.
Check data in data memory
and current values of counters,
and re-enter correct data. The
KV-300 CPU returns to normal
operation after the error is
cleared.
30
Scan time
error
Scan time exceeds 300 ms. Check the program again.
Be sure that there is no
excessive repetition using the
FOR-NEXT loop.
Be sure that an interrupt is not
executed at a higher rate.
40 NO PRO-
GRAM
An attempt was made to
operate the KV-300 CPU with
no program stored.
Write a program into the
KV-300 CPU.
50 SND/RTN
failure
Hardware error was detected
in a KV-300 CPU.
Turn the power to the KV-300
OFF and then ON again. If
the cause of the error is not
removed, the KV-300 CPU
may be faulty. Contact
nearest KEYENCE office.
51 Division by
zero
52 Address
error
53 Invalid
instruction
54 Watchdog
timer error
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-262
7
7.5.3 Transmission and Reception of Text Data
The KV-L2 can be connected to a device with an RS-232C or RS-422A port to load
consecutive text data (100 bytes maximum) as a batch into its data memory and to
send text data from data memory.
Assigning relay nos. and data memory address nos.
Specify the first relay no. of the internal relays and, from the assigned data memory
addresses (DM9700 to DM9707), specify the first DM no. of the data memory
addresses for transmission/reception of text data.
Port nos. and assigned DM nos.
Ports 1 and 2 access the assigned DM addresses shown in the following table.
I Designating the first relay no.
Five relay nos., including the first relay no., are assigned.
Specify the starting relay no. of the channel (the relay no. with "00" as the two
least significant digits) as the first relay no. Even if a relay in the middle of the
channel is designated as the first relay, the starting relay of the channel becomes
the first relay
Example: When specifying 1710 as the first relay no., relay nos. 1700 to 1704 are
assigned.
When 0000 is specified as the first relay no., the following relay nos. are as-
signed.
Designating the first DM no.
200 DM nos., including the first DM no., are assigned.
Duplicating DM nos. already used in the program will disable normal data transmis-
sion/reception.
KV-300 KV-L2
CPU
Text data
External unit
KV-L2 Port DM No. Designation
KV-L2 No. 1 Port 1 DM9700 First relay no.
DM9701 First DM no.
Port 2 DM9702 First relay no.
DM9703 First DM no.
KV-L2 No. 2 Port 1 DM9704 First relay no.
DM9705 First DM no.
Port 2 DM9706 First relay no.
DM9707 First DM no.
Port Relay nos. assigned
1 2400 to 2404
2 2500 to 2504
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-263
1
7
Note 1: Two KV-L2s can be connected to the KV-300 CPU. The KV-L2s are defined
as No.1 and No. 2, counting from the module closest to the KV-300 CPU.
Note 2: The designated relays and DM addresses are set at startup of special utility
relay 2307.
Assigning relays
Five relay nos., including the first relay no., are assigned. The assigned relays have
the following functions.
1. First relay no. +0
Turns ON after data is loaded and transferred to data memory. It remains ON,
preventing data loading. Write a program to turn this relay OFF after the process is
completed. (Data is loaded while the relay is OFF.)
To fetch the ON signal only for one scan, add the following line to the end of the
program.
2. First relay no. +1
Turns ON and remains ON when the loaded data cannot be transferred to data
memory because the first relay no. +0 is ON when the data is received, or a parity
error has occurred (that is, first relay no. +2 was ON) during data reception.
When the data is loaded at startup, the first relay no. +1 turns OFF.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
3. First relay no. +2
Turns ON and remains ON when the data cannot be received because a parity error
has occurred during data reception. (The first relay +0 turned ON simultaneously.)
When the data is loaded at startup, the first relay no. +2 turns OFF when the first
relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
4. First relay no. +3
Turns ON when text data transmission starts. Automatically turns OFF after trans-
mission is completed. If it is forced OFF in the middle of a transmission, data
transmission is stopped immediately. Use the SET/RES instruction to turn the relay
ON/OFF.
The transmission/reception of text data is enabled while the special utility relay 2307
is ON.
5. First relay no. +4
Transmits a break signal of approximately 160 msec duration at startup. Automati-
cally turns OFF after transmission is completed. Transmission is enabled while the
first relay no. +3 is OFF.
Use the SET/RES instruction or KEEP instruction to turn the relay ON/OFF.
Relay No. Function
First relay no. +0 ON when data has been loaded
+1 On when data has been loaded but not transferred to data memory
+2 On when a data reception error has occurred
+3 Data transmission start/stop ON: start, OFF: stop
+4 Transmits an approximately 160 msec break signal at startup.
(RES)

First relay no. +0) (
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-264
7
Assigning data memory addresses
200 DM addresses, including the first DM no., are assigned.
The assigned DM addresses have the following functions.
I Number of data bytes
The number of bytes in the first DM no. +0 and the first DM no. +100 becomes a
binary value. Write the binary data using the LDA/STA instruction or DW instruction.
I Text data
Enter the text data in ASCII, by byte per DM. ("00" is entered in the 8 high-order bits
and ASCII code is entered in the 8 low-order bits.)
Write the text data using the LDA/STA instruction or DW instruction.
Transmitting Text Data
This section describes transmission of text data in non-procedure mode.
The KV-L2 can transmit to an external unit the text data written to the assigned data
memory addresses, one byte per data memory address, in ASCII.
Data transmission and internal data memory addresses
Before starting communications, write the data to be transmitted into data memory
addresses in the following format.
"00" is loaded to 8 high-order bits and text data is loaded to 8 low-order bits, in
ASCII, as follows.
Use the LDA/STA instruction or DW instruction to write data into data memory.
ON/OFF status of special utility relays
The assigned special utility relays turn ON/OFF to transmit text data and a break
signal.
First relay no. +3
Turns ON when text data transmission starts. Automatically turns OFF after trans-
mission is completed. If it is forced OFF in the middle of a transmission, data
transmission is stopped immediately. Use the SET/RES instruction to turn the relay
ON/OFF.
The transmission/reception of text data is enabled while special utility relay 2307 is
ON.
DM No. Assigned data
First DM No. +0 Number of bytes of text data loaded
+1 to +99 Text data to be received
+100 Number of bytes of text data to be received
+101 to +199 Text data to be transmitted
1st DM no.+100
Number of data bytes data 1 data 99
Data memory
addresses
Number
data 2 data 3 to data 98
1st DM no.+101 1st DM no.+102 1st DM no.+103 to 1st DM no. +198 1st DM no.+199
D15
0
D14
0
D13
0
D12
0
D11
0
D10
0
D09
0
D08
0
D07
0
D06
0
D05
1
D04
1
D03
0
D02
0
D01
0
D00
1
Data memory
High-order 8 bits Low-order 8 bits
[00] [ASCII code]
Relay No. Function
First relay no. +3 Starts/ends text data transmission.
ON: Start transmission OFF: End transmission
+4 Transmits a break signal of approximately 160 msec duration at
startup.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-265
1
7
First relay no. +4
Transmits a break signal of approximately 160 msec duration at startup. Automati-
cally turns OFF after transmission is completed. Transmission is enabled while the
first relay no. +3 is OFF.
Use the SET/RES or KEEP instructions to turn the relay ON/OFF.
Note: Do not change the value of the text data (after the first DM +101) during
transmission, or an error will occur in the data being transmitted.
Receiving text data
The KV-300 CPU can write up to 100 bytes of text data contained between STX and
ETX into internal data memory addresses (DM9200 to DM9299), one byte per data
memory address in ASCII.
Receiving data format
Note that each piece of text data must include STX (02H) in the first byte followed by
the text (100 bytes max.) and ending with ETX (03H) in the last byte.
If transmitted text data includes ETX, the KV-L2 transfers the data up to immediately
before ETX to the data memory addresses. Text data after ETX is loaded as
separate data.
I Data memory addresses
The KV-300 can write received text data into the assigned data memory addresses,
one byte per data memory address, in ASCII.
00 is loaded to 8 high-order bits and text data is loaded to 8 low-order bits in ASCII
as follows.
ON/OFF status of special utility relays
The assigned utility relays turn ON only for the first scan when text data is loaded or
an error occurs.
I First relay no. +0
Turns ON after loading data and transferring it to the data memory addresses. It
remains ON, in which state data cannot be loaded. Write a program so that this relay
turns OFF after the process is completed. (Data is loaded while the relay is OFF.)
To fetch the ON signal only for one scan, add the following line to the end of the
program.
STX ETX data 1 data 2 data 3 data 99 - - - - - - - - - - Received data
data 1 data 99
Data memory
addresses
Number data 2 data 3 to data 98
Number of data bytes
1st DM no.+00 1st DM no.+01 1st DM no.+02
Number of data bytes
1st DM no.+03 to 1st DM no.+98 1st DM no.+99
C
R
Text data (100 bytes max.)
Last byte
or
C
R
L
F
D15
0
D14
0
D13
0
D12
0
D11
0
D10
0
D09
0
D08
0
D07
0
D06
0
D05
1
D04
1
D03
0
D02
0
D01
0
D00
1
Data memory
High-order 8 bits Low-order 8 bits
[00] [ASCII code]
Relay No. Description
First relay +0 Turns ON when text data has been loaded.
+1 Turns ON when text data has been loaded but not transferred to DM.
+2 Turns ON when an error occurs during text data reception.
(RES)

First relay no. +0) (
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-266
7
I First relay no. +1
Turns ON and remains ON when the loaded data cannot be transferred to data
memory because the first relay no. +0 is ON when the data is received, or a parity
error has occurred (that is, first relay no. +2 was ON) during data reception.
When the data is loaded at startup, the first relay no. +1 turns OFF.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
I First relay no. +2
Turns ON and remains ON when the data cannot be received because a parity error
has occurred during data reception. (The first relay +0 turned ON simultaneously.)
When the data is loaded at startup, the first relay no. +2 turns OFF when the first
relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
ASCII code/binary conversion function
Besides ASC and RASC instructions, the KV-300 CPU has a function to convert a
character string in ASCII code to a binary value, and vice versa. This function helps
simplify programs that convert text data to binary values or binary values to text
data.
ASCII to Binary conversion
1. All text data fetched at reception can be converted to binary data at one time. To
convert ASCII code to a binary value, use data memory addresses DM9600 and
DM9601 and special utility relay 2314 as follows.
I Special utility relay 2314
Special utility relay 2314 converts an ASCII string for the scan at startup and
transfers the converted data to data memory for the next scan.
For reception of a converted value, simplify the program by describing a loading
program prior to a conversion program through N.O. contact for 2314.
Refer to page 1-267.
I Data memory address DM9600
The DM address into which the ASCII string is to be written is specified in DM9600.
For example, when specifying the data loaded upon reception of text data, the first
DM address +1 selected during assignment of data memory addresses ( refer to
page 1-264) is written here.
I Data memory address DM9601
The first DM address in which converted binary data is written is specified in
DM9601. The converted binary data uses three DM addresses, including the first
DM address described above.
Avoid using DM addresses already used by the program.
2. Set DM addresses to which ASCII code is to be written as follows.
DM****+0 ASCII code length (text data bytes)
DM****+1 First value of ASCII string (data 1 of text data)
: :
DM****+99 Last value of ASCII string (data 99 of text data)
2314 Turn ON to execute conversion (for first scan time).
DM9600 Write the first address of the data memory into which ASCII strings are to be
stored.
DM9601 Write the first address of the data memory addresses into which converted
binary values are to be written.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-267
1
7
I ASCII code length
The number of text data bytes loaded during reception of text data is set here. For
example, when a 4-byte ASCII code [30H 31H 32H 40H] is received, [4] is set.
I ASCII string
Text data is input byte by byte in ASCII for each data memory address. Within data
memory addresses, "00" is loaded to the high-order 8 bits and ASCII code is loaded
to the low-order 8 bits. Refer to page 1-265.
3. The binary-converted value is loaded to data memory as follows.
I Binary
A binary value is input to 16 high-order bits and 16 low-order bits in data memory
addresses separately. Binary data that can be converted ranges from -2147483647
to 2147483647 in decimal.
A space (20H) in ASCII is converted to 0 in binary.
Negative numeric values are represented as a complement of two.
I Decimal position
The value of the decimal point represents the position of the data memory address in
which decimal point 2EH is stored, counting from the top of the ASCII string. For
example, if "38.5" is written to data memory as "33H 38H 2EH 35H" in ASCII, the
decimal point is in the third data memory position and "3" is set.
4. ASCII to binary conversion program
The following example shows a program that converts text data loaded at reception
of text data to binary form. The converted value is written to data memory addresses
starting from DM0000.
Binary to ASCII conversion
1. To convert a binary value to an ASCII string, use data memory addresses
DM9602 and DM9603 and special utility relay 2315 as follows.
I Special utility relay 2315
Special utility relay 2315 converts binary data during the scan at startup and
transfers the converted data to data memory for the next scan.
For reception of a converted value, simplify the program by describing a loading
program prior to a conversion program through N.O. contact for 2315.
Refer to page 1-269.
DM****+0 Binary high-order 16 bits
DM****+1 Binary low-order 16 bits
DM****+2 Decimal point (0: None,1 to 99: DM position)
2008
0001
0002
0003
2314
3000 1100 3000 2314 1100
DIFU RES
( )
#00000
< DW >
DM9600
#01500
< DW >
DM9601
#03000
< DW >
DM9700
#01000
< DW >
DM9701
< LDA >
DM1500
< STA >
DM2000
< LDA >
DM1501
< STA>
DM2001
< LDA >
DM1502
< STA >
DM2002
2315 Turn ON to execute conversion (for first scan time).
DM9602 Write the first address of the data memory to which the converted
ASCII strings are to be stored.
DM9603 Write the first address of the data memory into which a binary value
to be converted is loaded.
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-268
7
I Data memory address DM9602
The DM address into which the converted ASCII data is written is specified in
DM9602. For example, when the text data to be transferred is specified, the first DM
address +101 designated when data memory addresses are assigned ( Refer to
page 1-264) is written here.
I Data memory address DM9603
Write the first address of the data memory to which the binary data to be converted
is to be loaded. Binary data to be converted uses five DM addresses, including the
first DM address described above. Avoid using DM addresses already used by the
program.
2. Set the DM address into which ASCII code is to be written as follows.
I Binary
A binary value be converted is input to 16 high-order bits and 16 low-order bits in
data memory addresses separately.
I Decimal position
Specifies the decimal position written in the ASCII string. If 0, no decimal point is
specified.
After conversion, the ASCII code for decimal point (2EH) is stored in the specified
position counting from the top of the ASCII string. For example, when the binary
value is 1234 and decimal position is 2, the specified value becomes 1.234, which is
31H 2EH 32H 33H 34H in ASCII.
I Number of bytes in ASCII string
Specify the total number of bytes, including binary digits, +/- sign, and decimal point.
For example, when a value is -12.34, "6" is written here.
I Signs
Specify the +/- sign to be appended to the converted value (from binary to ASCII).
The +/- sign is stored in the first DM address of the ASCII string.
0: No sign
No +/- sign is appended to the ASCII-converted value. "0" can be specified when the
binary value is positive. If "0" is specified when a binary value is a complement of
two, the binary is treated as a positive value.
1: - sign
Converts a binary value by giving -(2DH) when the binary value is a complement of
two. Adds no sign to a positive binary.
2: sign
Converts a positive binary by giving +(2BH) and a negative binary (complement on
two) by giving -(2DH).
DM****+0 Binary code high-order 16 bits
DM****+1 Binary code low-order 16 bits
DM****+2 Decimal position (0: None, 1 to 99: DM position)
DM****+3 No. of bytes in ASCII string
DM****+4 Sign (0: Unsigned, 1: Add - 2: Add )
7.5 KV Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-269
1
7
Example program
Sample program
Text data received from an external device is converted to binary data and is
written in the DM0000 after conversion.
3. The ASCII-converted value is loaded to data memory addresses as follows.
The number of DM addresses used is the value specified as the number of bytes
in the ASCII string.
4. Program for converting binary data to ASCII
The following example shows a program that converts binary data to an ASCII
string during transmission of text data. The converted values are written to data
memory addresses starting from DM9301. The total number of digits, including
the decimal point, is written to DM9300.
0000
2315
1000
1000
2807
2315 #09301 #00000
DIFU
SET ( )
< DW > < DW >
DM9602 DM9603
DM****+0 First DM address of ASCII string (data 1 of text data)
: :
DM****+98 Last DM address of ASCII string (data 99 of text data)
2008
2314
3000 1100
1100
2314
DIFU
3000
RES ( )
#00000
< DW >
DM9600
#01500
< DW >
DM9601
#03000
< DW >
DM9700
#01000
< DW >
DM9701
DM1500
< LDA>
DM1200
< STA >
DM1501
< LDA >
DM2001
< STA >
DM1502
< LDA >
DM2002
< STA >
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-270
7
7.6 Display Interfac e Mode Programming
7.6.1 Operating in Display Interface Mode
Communications protocols
In Display Interface mode, the KV-L2 can be connected to a host computer (PC) or a
display device to monitor DM values, present values, set values of counters, and
timers, as well as relay ON/OFF information on the KV-300 CPU. It can also be used
to call up screens for insertion of numeric values on the display device with a wire-
saving system and simplified programs.
To begin, set the communications protocol to link mode and connect the KV-L2 to
the display device as described below.
Setting the operation mode
Turn OFF the power switch before setting the operation mode. Use the operation
mode setting switches A1 to A4 (SET A). A1 and A2 control the mode for port 1, and
A3 and A4 control the mode for port 2. (Ports 1 and 2 can be set independently.)
Set the operation mode setting switches A1 to A4 as shown above.
Setting the communications protocol
Set the baud rate, data bit length, parity, and stop bit using the SET B communica-
tions protocol setting switch accordance to the specifications of the display device.
Turn OFF the power switch before changing settings.
ON
OFF
A1 A2 A3 A4
Operation mode Port 1 Port 2
A1 A2 A3 A4
KV mode OFF OFF OFF OFF
Display Interface mode OFF ON OFF ON
Non-procedure mode ON ON ON ON
ON
OFF
B1 B2 B3 B4 B5 B6 B7 B8
B1 B2 B3 B4 B5 B6 B7 B8*
Baud rate 1200 bits/s OFF OFF OFF OFF
2400 bits/s ON OFF OFF OFF
4800 bits/s OFF ON OFF OFF
9600 bits/s ON ON OFF OFF
19200 bits/s OFF OFF ON OFF
31250 bits/s ON OFF ON OFF
38400 bits/s OFF ON ON OFF
Setting disabled ON ON ON OFF
Parameters Data bits 7 bits OFF OFF
8 bits ON OFF
Parity None OFF OFF OFF
Odd ON OFF OFF
Even ON ON OFF
Stop bit 1 bit OFF OFF
2 bits ON OFF
* Always leave B8 set to the OFF position.
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-271
1
7
Note 1: Turn off the power switches before setting switches.
Note 2: Communications protocols for the modules to be connected must be identi-
cal; otherwise, communication will fail. For settings of external units to be connected,
refer to the operation manuals supplied with the respective units.
Note 3: For settings of the display device, refer to the Users Manual of your display
device.
Note 4: The communications protocols settings apply to both ports 1 and 2. The two
ports cannot be set to different protocols.
Communications control procedure
In Display Interface mode, the KV-L2 provides a special interactive communications
procedure, detailed below.
Communications procedure
In Display Interface mode, the host computer sends a command to the KV-L2 and
the KV-L2 automatically returns a response.
FCS (frame check sequence)
The FCS is a method of detecting communications errors. An 8-bit exclusive OR
from the top of the command or response up to the last character of the text is
converted into a 2-character ASCII code.
Calculation example
@ 0 1 W D 0 3 E 8 1 9 6 4 2 6 * CR
station no. header code---------------------------text---------------------------FCS terminator
@ 0 1 0 0 0 0 0 0
Exclusive OR
0 0 0 1 1 0 0 0 0
Exclusive OR
1 0 0 1 1 0 0 0 1
Exclusive OR
1 0 0 1 1 0 0 0 1
: :
: :
6 0 0 1 1 0 1 1 0
Exclusive OR
4 0 0 1 1 0 1 0 0
Exclusive OR
---------------------------------------------------------
0 0 1 0 0 1 1 0
ASCII 2 6 <----------FCS Value
(Host computer)
Station no.
Header code
Text
FCS
Terminator
Command
KV-L2
Station no.
Header code
Text
FCS
Terminator
Response
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-272
7
This example command indicates station number 1, header code WD (update data
memory), data memory start number as 1000 or 03E8 in Hex, data to write as 6500
or 1964 in Hex.
Example program
5 I = 0:FCS=0
10 INPUT "ENTER TEXT TO TRANSMIT";A$
15 I = I +1
20 FCS = FCS XOR (ASC(MID$(A$,I,1)))
30 IF I < LEN(A$) THEN 15
40 PRINT "FCS=";HEX$(FCS);"H"
This program automatically calculates the FCS value when you enter the text to the
PC with the keyboard and shows the result in display.
Note 1: Commands and responses begin with the station no. and header code and
end with the FCS and terminator.
Note 2: Up to 131 characters can be sent during a single transmission. To send a
command which has more than 131 characters, divide it into several segments and
send each of them sequentially.
Refer to "7.6.2 Command and Response Format" on the next page.
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-273
1
7
7.6.2 Command and Response Format
The format for commands and responses is as follows.
Format used when sending a command of 132 characters or more
1. First transmission data (131 characters max.)
2. Intermediate data transmission (128 characters max.)
3. Last transmission data (128 characters max.)
Note 1: When a command is divided into several segments for transmission, the first
and intermediate segments end with the delimiter (CR) instead of the terminator.
Note 2: When dividing a write command such as WR, WL, WH, WC, and WD, into
segments, do not divide a 4-character data for a same channel. Divide data by a 4-
character data for a channel.
Communication procedure when dividing a command into segments and sending
them sequentially
@ x x x x x x
C
R
Station no. (00 to 15) Header code Text (122 characters max.) FCS Terminator
FCS calculation range
@ X X X X X X
C
R
Station no. (00 to 15) Header code Text no. 1 (123 characters max.) FCS Delimiter
FCS calculation range
Text no. 2 (125 characters max.)
X X
C
R
FCS Delimiter
FCS calculation range
Text no. 3 (124 characters max.)
X X
C
R
FCS Terminator
FCS calculation range
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-274
7
Note 1: When several commands are being sent in succession, send the delimiter
(CR) of the current command before sending the succeeding command. Set the
delimiter timeout to at least 2 seconds.
Host computer
S
t
a
t
i
o
n

n
o
.
H
e
a
d
e
r

c
o
d
e
T
e
x
t
F
C
S
D
e
l
i
m
i
t
e
r
S
t
a
t
i
o
n

n
o
.
H
e
a
d
e
r

c
o
d
e
T
e
x
t
F
C
S
T
e
r
m
i
n
a
t
o
r
S
t
a
t
i
o
n

n
o
.
H
e
a
d
e
r

c
o
d
e
T
e
x
t
F
C
S
D
e
l
i
m
i
t
e
r
S
t
a
t
i
o
n

n
o
.
H
e
a
d
e
r

c
o
d
e
T
e
x
t
F
C
S
T
e
r
m
i
n
a
t
o
r
T
e
x
t
F
C
S
D
e
l
i
m
i
t
e
r
T
e
x
t
F
C
S
T
e
r
m
i
n
a
t
o
r
T
e
x
t
F
C
S
T
e
r
m
i
n
a
t
o
r
T
e
x
t
F
C
S
D
e
l
i
m
i
t
e
r
D
e
l
i
m
i
t
e
r
D
e
l
i
m
i
t
e
r
D
e
l
i
m
i
t
e
r
D
e
l
i
m
i
t
e
r Host computer
KV-L2
KV-L2
First command Intermediate command Last command
First command Intermediate command Last command
Next transmission
OK
Next transmission
OK
Next transmission
OK
Next transmission
OK
Command
Response
Note 2: When several divided responses are being received, send a delimiter (CR)
to the KV-L2 after receiving the first delimiter from the KV-L2. This enables the KV-
L2 to send the next response; otherwise, your personal computer will not receive the
next response from the KV-L2.
Note 3: The FCS (frame check sequence) is a method of detecting communication
errors. An 8-bit exclusive OR from the top of the command/response to the last
character of the text is converted to 2-character ASCII code.
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-275
1
7
7.6.3 Commands and Responses
This section describes the command and response format used in Display Interface
mode and the command setting method.
List of commands and responses
Range of available station nos.: 00 to 15
I Format of commands and responses
Command Response
Header Function Header Command Header Response
code code data code data
RR Read I/O relay/internal RR Read start ch. Number of RR End code
utility relay channel to read Data read
RH Read temporary memory RH Read start no. RH End code
address/analog timer Number of timer to read Data read
RC Read current value of counter/ RC Read start no. RC End code
timer/high-speed counter Number of counter/timer to read Data read
RG Read status of counter/timer RG Read start no. RG End code
/high-speed counter comparator Number of counter/timer/ ON/OFF information
comparator to read
RD Read DM RD Read start DM no. RD End code
Number of DM to read Data read
RJ Read I/O relay /internal RJ Read start ch. RJ End code
utility relay Number of channel to read Data read
WR Force update of I/O relay/ WR Write start ch. WR End code
internal utility relay Data to write
WH Update temporary memory WH Write start ch. WH End code
address Data to write
WC Update current value of WC Write start no. WC End code
counter/timer/high-speed Data to write
counter
WG Force-update status of WG Write start no. WG End code
counter/timer/high-speed Data to write
counter comparator
WD Update DM value WD Write start no. WD End code
Data to write
WJ Force update of I/O relay/ WJ Write start ch. WJ End code
internal utility relay Data to write
R# Read set value of counter/ R# Instruction word R# End code
timer/high-speed counter Operand Set value
comparator
W# Update set value of W# Instruction word W# End code
counter/timer/high-speed Operand
counter comparator New set value
MS Read KV-300 CPU MS MS End code Operation
operation mode mode
SC Change KV-300 CPU SC Operation mode SC End code
operation mode
FCS @
C
R
Station no.
Header
code
Command/response
data
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-276
7
I Setting command data
Set the command data with ASCII characters.
1. Station no.
Use two ASCII code characters to set the station no. For reference, station no.
"01" is converted to "30 31" in ASCII code values as follows.
Station no. (ASCII characters)
ASCII code conversion for FCS calculation
2. Header code
Use two ASCII characters (four characters for QQMR and QQIR) to set the
header code. For reference, the read relay command "RR" is converted to "52
52" in ASCII code values as follows.
Header code (ASCII characters)
ASCII code conversion for FCS calculation
KS Set KS Device KS End code
No. to change
Bit to change
KR Reset KR Device KR End code
No. to change
Bit to change
FK Set/reset multiple channels FK Device FK End code
Nos. to change
Data to force-set/reset
CR Read values of CR CR End code
DM0008 to DM0015 Data of DM0008 to
DM0015
MM Read model code MM MM End code 13
TS Test TS Any characters TS Any characters
(122 characters max.) (122 characters
max.)
QQMR Register combined commands QQMR Ch. no. of device QQMR End command
and monitor I/Os Operand
QQIR Read combined commands QQIR QQIR End code
and monitor I/Os Data read from
registered table
XZ Abort XZ No response
** Initial ** (No station no. or FCS) No response
IC Command undefined error No command IC
Command execution Header End code
disabled code
FCS @
C
R
Station no.
Header
code
Command/response
data
"40H" in ASCII code .
"ODH" in ASCII code value .
"2AH" in ASCII code value .
0 1
30H
31H
R R
52H
52H
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-277
1
7
3. Command data
Set the relay no., data memory address, and instruction word using ASCII char-
acters. For reference, the relay no. "0015" is converted to "30 30 31 35" in ASCII
code values, and the instruction word "CNT_" to read the set value of counter/
timer (R#) is converted to "43 4E 54 20" in ASCII codes .
Command code(ASCII characters)
ASCII code conversion for FCS calculations
4. FCS (frame check sequence)
The FCS (frame check sequence) is a method for detecting a communication
error. It calculates the exclusive OR within the following range. The calculated 8-
bit data is converted to a 2-ASCII character.
Description of commands and responses
This section describes the format of commands and responses. In the following
figure, "n" represents one ASCII character (1 byte). The characters stand for two
types of values: One is a decimal value representing a numeric value between 0 and
9 for station no., channel no., address no., and timer/ counter values: the other is a
hexadecimal value representing a numeric value between $0 and $F for binary data
bit information of I/O or Data Memory.
Read I/O relay/internal utility relay (RR)
This command reads the I/O relays/internal utility relays starting from the specified
channel no. within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Read temporary data memory address/analog timer (RH)
This command reads the current value of the temporary data memory address/
analog timer starting from the specified no. within the specified range.
@
C
R
FCS Station no.
Header
code
Command/response
data
FCS calculation range
Station no.
nn
@ RR FCS
C
R
End code
nn
Data
nnnn
Data
nnnn
Header code Terminator Data of read start ch.
+1(in hexadecimal)
Data of read start ch.
(in hexadecimal)
@
FCS RR
C
R
Station no.
nn
Read start
ch.
nnnn
Number of
channels to
read: nnnn
Header
code
00 to 15
(in decimal)
Terminator 0001 to 0180
(in decimal)
0000 to 0179
(in decimal)
0 0 1 5 C N T
4EH 30H 31H
30H 35H 20H
43H
54H
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-278
7
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The values of the temporary memory address (TM) and analog trimmer
cannot be read with a same single command at once. Read each value separately.
Note 2: The station no. is indicated in decimal; the end code, in hexadecimal.
Read current value of counter/timer/high-speed counter (RC)
This command reads the current value of the counter/timer/high-speed counter
starting from the specified no. within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The values of the counter/timer and high-speed counter cannot be read with
a same single command at once. Read the counter/timer and high-speed counter
values individually.
Note 2: The station no. is indicated in decimal; the end code, in hexadecimal.
Read start No. Data to read
0000 to 0031 TM00 to TM31
0032 Trimmer value 0
0033 Trimmer value 1
Station no.
nn
@ RC FCS
C
R
Read start
no.
nnnn
Number of
counters/timers
to read
nnnn
Header
code
00 to 15
(in decimal)
Terminator
0001 to
0250/0001 to
0002 (in
decimal)
0000 to
0249/0254 to
0255 (in
decimal)
Read start No. Data to read
0000 to 0249 Counter/timer
0254 High-speed counter CTH0
0255 High-speed counter CTH1
Station no.
nn
@ RC FCS
C
R
End code
nn
Data
nnnn
Data
nnnn
Header code
Terminator
Data of read start no. +1
(in decimal)
Data of read start no.
(in decimal)
@
RH FCS
C
R
Station no.
nn
Read start no.
nnnn
Number of
memories/
timers to read
nnnn
Header
code
00 to 15
(in decimal)
Terminator 0001 to 0032/
0001 to 0002
(in decimal)
0000 to 0031/
0032 to 0033
(in decimal)
@ RH FCS
C
R
Station no.
nn
End code
nn
Data
nnnn
Data
nnnn
Header
code
Terminator Data of read start no. +1
(in hexadecimal)
Data of read start no. (in
hexadecimal)
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-279
1
7
Read status of counter/timer/high-speed counter comparator (RG)
This command reads the ON/OFF status of the counter/timer/high-speed counter
comparator starting from the specified no. within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The values of the counter/timer and high-speed counter comparator CTC
cannot be read with a same single command at once. Read the counter/timer and
CTC values individually.
Note 2: The station no. is indicated in decimal; the end code, in hexadecimal.
Read DM value (RD)
This command reads values of the data memory addresses starting from the
specified DM address within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Read I/O relay/internal utility relay (RJ)
Reads values of the I/O relays/internal utility relays starting from the specified relay
ch. within the specified range.
Read start No. Data to read
0001 to 0249 Timer/counter
0250 High-speed counter comparator CTC0
0251 High-speed counter comparator CTC1
0252 High-speed counter comparator CTC2
0253 High-speed counter comparator CTC3
0001 to 0250/
0001 to 0004
(in decimal)
Station no.
nn
@ RG FCS
C
R
End code
nn
ON/
OFF
ON/
OFF
Header code
Terminator Data of read start no. +1
(ON: 1 OFF: 0)
Data of read start no.
(ON: 1 OFF: 0)
@ RD FCS
C
R
Station no.
nn
End code
nn
Data
nnnn
Data
nnnn
Header code
Terminator Data of read start DM
no.+1 (in hexadecimal)
Data of read start DM
no. (in hexadecimal)
Station no.
nn
@ RG FCS
C
R
Read start
no.
nnnn
Number of
counters/timers/
comparators to
read nnnn
Header
code
00 to 15
(in decimal)
Terminator
0000 to 0249/
0250 to 0253
(in decimal)
@ RD FCS
C
R
Station no.
nn
Read start
DM no.
nnnn
Number of DMs
addresses to
read
nnnn
Header
code
00 to 15
(in decimal)
Terminator
0001 to 10000
(in decimal)
0000 to 9999
(in decimal)
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-280
7
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Forced update of I/O relay/internal utility relay (WR)
This command forces updating (overwriting) of values of the I/O relays/internal utility
relays starting from the specified ch. within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The KV-300 CPU has 10 input addresses, 0000 to 0009. Therefore, when
data is written to 0000 ch, the KV-300 CPU ignores data written to input relays 0010
to 0015. Data cannot be written to addresses 0002 to 0004, or to addresses 0070 or
higher.
Note 2: Data cannot be written across special utility relays.
Update temporary data memory address (WH)
This command updates the temporary data memory addresses starting from the
specified TM no. within the specified range.
I Command format
Station no.
nn
@ RJ FCS
C
R
Read start ch.
nnnn
Number of
channels to
read
nnnn
Header
code
00 to 15
(in decimal)
Terminator 0001 to 0180
(in decimal)
0000 to 0179
(in decimal)
@ RJ FCS
C
R
Station no.
nn
End Code
nn
Data
nnnn
Data
nnnn
Header
code
Terminator Data written to write start
ch. +1 (in hexadecimal)
Data written to write start
ch. (in hexadecimal)
Station no.
nn
@ WR FCS
C
R
Write start
ch.
nn
Data to write
nnnn
Data to write
nnnn
Header
code
Terminator 00 to 15
(in decimal)
Data written to
write start ch. +1
(in hexadecimal)
Data written to
write start ch.
(in hexadeci-
mal)
0000 to
0069 (in
decimal)
@ WR FCS
C
R
Station no.
nn
End code
nn
Header code Terminator
Station no.
nn
@ WH FCS
C
R
Write start
TM no.
nnnn
Data to write
nnnn
Data to write
nnnn
Header
code
00 to 15
(in decimal)
Terminator Data written to
write start TM
no. +1 (in
hexadecimal)
Data written
to write start
TM no. (in
hexadecimal)
0000 to 0029
(in decimal)
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-281
1
7
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: Data cannot be written to TM30 and TM31, which are read-only memory
addresses. Attempting to do so, causes a replacement data error and the end code
"15" is returned.
Note 2: The station no. is indicated in decimal; the end code, in hexadecimal.
Update current value of counter/timer/high-speed counter (WC)
This command updates the current values of the counters/timers/high-speed
counters starting from the specified counter/time no. within the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The values of the counter/timer and high-speed counter CTH cannot be
updated with a same single command at once. Write the counter/timer and CTH
values individually.
Note 2: The station no. is indicated in decimal; the end code, in hexadecimal.
Forced update of status of counter/timer/high-speed counter comparator (WG)
This command forces updating of the ON/OFF status of the counters/timers/high-
speed counter comparators, starting with the specified counter/timer no. within the
specified range.
I Command format
@ WH FCS
C
R
Station no.
nn
End code
nn
Header code Terminator
@ WC FCS
C
R
Station no.
nn
Write start
counter/timer
no. nnnn
Data to write
nnnn
Data to write
nnnn
Header
code
00 to 15
(in decimal)
Terminator
Data written to
write start counter/
timer no. +1 (in
hexadecimal)
Data written to
write start
counter/timer
no. (in
hexadecimal)
0000 to
0249/0254
and 0255
(in decimal)
Station no.
nn
@ WC FCS
C
R
End code
nn
Header code Terminator
Write start No. Data to write
0001 to 0249 Counter/timer
0254 High-speed counter CTH0
0255 High-speed counter CTH1
Station no.
nn
@ WG FCS
C
R
Write start
counter/timer
no. nnnn
Data to write
nnnn
Data to write
nnnn
Header
code
00 to 15
(in decimal)
Terminator Data written to
write start counter/
timer no. +1 (in
hexadecimal)
Data written to
write start
counter/timer no.
(in hexadecimal)
0000 to
0249/0250
and 0253
(in decimal)
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-282
7
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The values of the counter/timer and high-speed counter comparator CTC
cannot be updated with a same single command at once. Write the counter/timer
and CTC values individually.
Note 2: High-speed counter comparator CTC can be turned OFF but cannot be
turned ON.
Note 3: The station no. is indicated in decimal; the end code, in hexadecimal.
Update DM value (WD)
This command updates the DM values starting from the specified DM address within
the specified range.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Forced update of I/O relay/internal utility relay (WJ)
This command forces updating of the I/O relays/internal utility relays starting from
the specified ch. no. within the specified range.
I Command format
@ WG FCS
C
R
Station no.
nn
End code
nn
Header code Terminator
Write start No. Data to write
0001 to 0249 Counter/timer
0250 High-speed counter comparator CTC0
0251 High-speed counter comparator CTC1
0252 High-speed counter comparator CTC2
0253 High-speed counter comparator CTC3
@ WD FCS
C
R
Station No.
nn
End code
nn
Header code Terminator
Station No.
nn
@ WD FCS
C
R
Write start
DM address
nnnn
Data to write
nnnn
Data to write
nnnn
Header
code
0000 to 9999
(in decimal)
Terminator
Data written to
write start DM
address +1 (in
hexadecimal)
Data written
to write start
DM address
(in hexadeci-
mal)
Data written
to wite start
DM address
(in hexadeci-
mal)
Station No.
nn
@ WJ FCS
C
R
Write start
ch.
nnnn
Data to write
nnnn
Data to write
nnnn
Header
code
0000 to 9999
(in decimal)
Terminator
Data written to
write start ch. +1
(in hexadecimal)
Data written
to writestart
ch. (in
hexadeci-
mal)
0000 to
0069 (in
decimal)
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-283
1
7
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The KV-300 CPU has its own 10 input ports (0000 to 0009); therefore, when
data is written to 0000 ch, the KV-300 CPU ignores data to be written to input relays
0010 to 0015.
Note 2: Data cannot be written to addresses 0002 to 0004, or to addresses 0070 or
higher.
Note 3: Data cannot be written across special utility relays.
Note 4: The station no. is indicated in decimal; the end code, in hexadecimal.
Read set value of counter/timer/high-speed counter comparator (R#)
This command reads set values of the specified counter/timer/high-speed counter
comparator in the form of 4-digit BCD.
I Command format
* An instruction word is specified with uppercase alphabetical characters.
An underscore (_) represents a space.
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: An underscore (_) in the instruction word represents a space. Be sure to
include the underscore in the instruction word when transmitting the command.
Note 2: If a set value exceeds 10000, 9999 is returned as the set value.
The station no. is indicated in decimal; the end code, in hexadecimal.
Update set value of counter/timer/high-speed counter comparator (W#)
This command updates the set value of the specified counter/timer/high-speed
counter comparator.
@ WJ FCS
C
R
Station No.
nn
End code
nn
Header code Terminator
@ R# FCS
C
R
Station No.
nn
Instruction
word
xxxx
Operand
nnnn
Header code 00 to 15
(in decimal)
Terminator
Instruction word Operand Data
CNT_ 0000 to 00249 Counter/timer
TIM_
CNT_ 0250 to 0253 High-speed counter comparator
@ R# FCS
C
R
0000 to 9999
(in decimal)
Station No.
nn
End code
nn
Set value
nnnn
Header code
Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-284
7
I Command format
* An instruction word is specified with uppercase alphabetical characters.
An underscore (_) represents a space.
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: An underscore (_) in the instruction word represents a space. Be sure to
include the underscore in the instruction word when transmitting the command.
Note 2: A set value exceeding 10000 cannot be specified.
The station no. is indicated in decimal; the end code, in hexadecimal.
Read KV-300 CPU operation mode (MS)
This command reads the KV-300 CPU operation status.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Change KV-300 CPU operation mode (SC)
This command changes the KV-300 CPU operation mode.
I Command format
Station No.
nn
@ W# FCS
C
R
Instruction
word
xxxx
Operand
nnnn
New set
value
nnnn
Header code 00 to 15
(in decimal)
Terminator 0000 to 9999
(in decimal)
Instruction word Operand Data
CNT_ 0000 to 00249 Counter/timer
TIM_
CNT_ 0250 to 0253 High-speed counter comparator
@ W# FCS
C
R
Station No.
nn
End code
nn
Header code
Terminator
Station No.
nn
@ MS FCS
C
R
Header
code
00 to 15
(in decimal)
Terminator
Station No.
nn
@ MS FCS
C
R
End code
nn
Operation
mode
nnnn
Header code
Terminator RUN mode: 0061,
PROGRAM mode: 0261
Station No.
nn
@ SC FCS
C
R
Operation
mode
nn
Header code Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-285
1
7
I Response format (When the command is executed normally, the response
includes the end code "00".)
Set (KS)
This command sets the ON/OFF status of the specified channel of the I/O relay,
internal utility relay, temporary memory address, timer, counter, or high-speed
counter comparator.
I Command format
* An instruction word is specified with uppercase alphabetical characters.
An underscore (_) represents a space.
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: High-speed counter comparator CTC cannot be force-reset.
Note 2: The temporary memory address can be changed by bit.
Note 3: An underscore (_) in the instruction word represents a space. Be sure to
include the underscore in the instruction word when transmitting the command.
Note 4: The station no., ch. no. to change, and bit to change are indicated in
decimal; the end code, in hexadecimal.
Reset (KR)
This command resets the ON/OFF status of the specified channel of the I/O relay,
internal utility relay, temporary memory address, timer, counter, or high-speed
counter comparator.
Operation mode Description
00 PROGRAM mode
01, 02, 03 RUN mode
@ SC FCS
C
R
Station No.
nn
End code
nn
Header code Terminator
Station No.
nn
@ KS FCS
C
R
Device
xxxx
Ch. no. to
change
nnnn
Bit to
change
nn
Header code 00 to 15
(in decimal)
Terminator
Device Ch. No. to change Bit to change Data
CIO_ 0000 to 0179 00 to 15 I/O relay, internal utility relay
HR_ _ 0000 to 0031 00 to 15 Temporary memory address
AR_ _ 0000 to 0179 00 to 15 I/O relay, internal utility relay
TIM_ 0000 to 0249 00 Timer
CNT_ 0000 to 0249 00 Counter
@ KS FCS
C
R
Station No.
nn
End code
nn
Header code Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-286
7
I Command format
An instruction word is specified with uppercase alphabetical characters.
An underscore (_) represents a space.
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: Temporary memory addresses can be changed by bit.
Note 2: An underscore (_) in the instruction word represents a space. Include the
underscore in the instruction word when transmitting the command.
Note 3: The station no., ch. to change, and bit to change are indicated in decimal;
the end code, in hexadecimal.
Set/reset multiple channels (FK)
This command sets or resets the ON/OFF status of the specified I/O relay, internal
utility relay, temporary data memory address, timer, counter, or high-speed counter
comparator by channel.
I Command format
* An instruction word is specified with uppercase alphabetical characters. An
underscore (_) represents a space.
@ KR FCS
C
R
Station No.
nn
Device
xxxx
Ch. no. to
change nnnn
Bit to change
nn
Header code 00 to 15
(in decimal)
Terminator
Station No.
nn
@ KR FCS
C
R
End code
nn
Header code Terminator
@ FK FCS
C
R
Station No.
nn
Device
xxxx
Channel to
change
nnnn
Data to force-set/-reset
mmmmmmmmmmmmmmmm
Header
code
00 to 15
(in decimal)
Terminator
"m" represents a bit of data
(total: 16 bits)
Device Ch. No. to change Bit to change Data
CIO_ 0000 to 0179 00 to 15 I/O relay, internal utility relay
HR_ _ 0000 to 0031 00 to 15 Temporary memory address
AR_ _ 0000 to 0179 00 to 15 I/O relay, internal utility relay
TIM_ 0000 to 0249 00 Timer
CNT_ 0000 to 0249 00 Counter
CNT_ 0250 to 0253 00 High-speed counter comparator CTC
Device Ch. No. to change Bit to change Data
CIO_ 0000 to 0179 00 to 15 I/O relay, internal utility relay
HR_ _ 0000 to 0031 00 to 15 Temporary memory address
AR_ _ 0000 to 0179 00 to 15 I/O relay, internal utility relay
TIM_ 0000 to 0249 00 Timer
CNT_ 0000 to 0249 00 Counter
CNT_ 0250 to 0253 00 High-speed counter comparator CTC
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-287
1
7
I Code list of data to force-set/-reset
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: High-speed counter comparator CTC cannot be force-reset.
Note 2: The temporary memory addresses can be changed by bit.
Note 3: An underscore (_) in the instruction word represents a space. Be sure to
include the underscore in the instruction word when transmitting the command.
Note 4: The counter/timer values and high-speed counter comparator values cannot
be set or reset with a same single command at once. Set or reset these values
individually.
Note 5: The station no., ch. to change, and bit to change are indicated in decimal;
the end code, in hexadecimal.
Read values from DM0008 to DM0015 (CR)
This command reads the values from DM0008 to DM0015 with a short command.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Read model code (MM)
This command reads the KV-300 model code (13).
I Command format
m Description
0, 8 No operation
2, 4 Reset
3, 5 Set
Station No.
nn
@ FK FCS
C
R
End code
nn
Header code
Terminator
Station No.
nn
@ CR FCS
C
R
Header
code
00 to 15
(in decimal)
Terminator
@ CR FCS
C
R
Station No.
nn
End code
nn
Data
nnnn
Data
nnnn
Data
nnnn
Header code
Terminator Value of DM0015
(in hexadecimal)
Value of DM0009
(in hexadecimal)
Value of DM0008
(in hexadecimal)
Station No.
nn
@ MM FCS
C
R
Header code 00 to 15
(in decimal)
Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-288
7
I Response format (When the command is executed normally, the response
includes the end code "00".)
Test (TS)
This command returns the exact command sent from the host computer as a
response.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note: The command returns a terminator or delimiter (whichever was given) as the
data delimiter.
Combined commands for registering monitor I/Os (QQMR)
This command registers the devices such as I/O relays, counters, timers, data
memory addresses, temporary data memory addresses, high-speed counters, or
high-speed counter comparators that are to be read into the table. Once registered,
these values are retained until the restart or initial command is received, data is re-
registered, or power is cut off. The table registered by this command is to be read by
the monitor I/O read command.
I Command format
* A device is specified with uppercase alphabetical characters. An underscore (_)
represents a space. Set any character except the control code as the operand.
ON/OFF shows the contact status.
Station No.
nn
@ MM FCS
C
R
End code
nn
Model code
nn
Header code Terminator (KV-300): 13 (in hexadecimal)
Station No.
nn
@ TS FCS
C
R
Any char140 acters
(122 characters max., except "CR")
Header code 00 to 15
(in decimal)
Terminator
(or delimiter)
Station No.
nn
@ TS FCS
C
R
Any characters
(122 characters max., except "CR")
Header code Terminator
(or delimiter)
@ QQ MR
FCS
,
,

C
R
Station no.
nn
Device
xxxx
Ch. no.
nnnn
Operand
nn
00 to 15
(in decimal)
Header
code
Sub header code
Device
xxxx
Ch. no.
nnnn
Operand
nn
Data delimiter
Device Ch. No. Operand Response Data
CIO_ 0000 to 0179 00 to 15 or CH ON/OFF or channel data I/O relay, internal utility relay
HR_ _ 0000 to 0031 00 to 15 or CH ON/OFF or channel data Temporary data memory address
AR_ _ 0000 to 0179 00 to 15 or CH ON/OFF or channel data I/O relay, internal utility relay
TIM_ 0000 to 0249 Any characters or CH ON/OFF or ON/OFF + current value Timer
CNT_ 0250 to 0249 Any character or CH ON/OFF or ON/OFF + current value Counter
CNT_ 0250 to 0253 Any character or CH ON/OFF or ON/OFF + current value High-speed counter comparator CTC
DM_ _ 0000 to 9999 Any character Channel data DM
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-289
1
7
When specifying ch. nos. 0250 to 0253 for CNT_, CTC and CTH can be monitored.
The specified ch. no. of the device has the following ON/OFF data and current
values.
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: Up to 128 channels can be registered. Attempting to registering more than
128 channels will result in an error (end code: 5A).
Note 2: A device is specified with uppercase alphabetical characters. An underscore
(_) represents a space.
Note 3: The station no., ch. to change, and bit to change are indicated in decimal;
the end code, in hexadecimal.
Combined commands for reading monitor I/Os (QQIR)
This command reads the ch. information or DM data according to the table registered
by the monitor I/O register command.
I Command format
I Response format (When the command is executed normally, the response
includes the end code "00".)
Note 1: The data is read in the order it was registered by the monitor I/O register
command.
Note 2: The station no., ch. to change, and bit to change are indicated in decimal;
the end code, in hexadecimal.
Note 3: For the counter/timer, only the ON/OFF data is read if no ch. is specified at
registration.
Channel No. 0250 0251 0252 0253
ON/OFF data CTC0 CTC1 CTC2 CTC3
Current value CTH0 CTH0 CTH1 CTH1
Station No.
nn
@ QQ MR FCS
C
R
Station No.
nn
Header code Sub header code Terminator
Station No.
nn
@ QQ IR FCS
C
R
Header
code
Sub
header
code
Terminator 00 to 15
(in decimal)
@ QQ IR
ON/
OFF
FCS
ON/
OFF
, , ,
,

C
R
Station no.
nn
End code
nn
Ch. data
nnnn
Header code Sub header code
ON/OFF information + current
value when ch. of counter/timer
is specified
Data
delimiter
Bit ON/OFF
information
Ch. data
nnnn
Data to be read (in hexadecimal) when
ch. of I/O relay, internal utility relay,
temporary data memory address, or
data memory address is specified.
Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-290
7
Abort (XZ)
The abort command allows the KV-L2 to stop the current operation and accept a
new command. This command generates no response.
I Abort command
Initialize
The command initializes all station nos. This command requires no station no., FCS,
and generates no response.
I Initial command
Undefined command error response (IC)
This is a response returned when a command header code cannot be read or
undefined code was sent. Check the header code and send the correct code.
I Response format
Error response when a command cannot be executed
This is an error response returned when a received command cannot be executed.
The error description is indicated in the end code.
I Response format
Note 1: Header codes are specific to received commands.
Note 2: Some commands (combined commands) may have sub header code in
addition to the header code.
Station No.
nn
@ XZ FCS
C
R
Header
code
00 to 15
(in decimal)
Terminator
@
C
R
Station No.
nn
@ IC FCS
C
R
Header
code
00 to 15
(in decimal)
Terminator
Station No.
nn
@ FCS
C
R
End code
nn
Header code
(sub-header code) of
received command
Terminator
7.6 Display Interface Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-291
1
7
End codes
The following table summarizes end codes and remedies
End Description Cause Remedy
code
00 Normal end
10 Parity error KV-L2 detects parity
error during command
reception.
Transmission may be
affected by noise.
Retransmit the command.
11 Framing error KV-L2 fails to detect stop
bit during command
reception.
12 Overrun error KV-L2 receives the next
command during recep-
tion of current command.
KV-L2 operation is
delayed. Reduce baud
rate and retry transmis-
sion.
13 FCS error FCS is incorrect. This
error may be generated
by FCS calculation error
or noise.
Check the FCS calcula-
tion procedure. If the
error is caused by noise,
retransmit the command.
14 Format error Command format is
incorrect.
Check and correct the
command format and
retransmit the command.
15 Replacement data error Wrong area is specified
for read/write.
Specify the correct area
and retry transmission.
18 Frame length MAX error Command exceeds the
max. length for one
transmission.
Divide the frame into two
and retry transmission.
19
Execution disabled error Monitor I/O is not regis-
tered.
Register the monitor I/O
and execute the com-
mand.
A0 Aborted due to parity error
in transmitted data during
execution of command.
Various errors can occur
during a write command
is executed across
several frames. Data
transmitted before the
occurrence of the error is
written to the specified
areas on the KV-300
CPU.
Retry transmission from
the beginning.
A1 Aborted due to framing
error in transmitted data
during execution of
command.
A2 Aborted due to overrun
error in transmitted data
during execution of
command.
A3 Aborted due to FCS error
in transmitted data during
execution of command.
A4 Aborted due to format
error in transmitted data
during execution of
command.
A5 Aborted due to replace-
ment error in transmitted
data during execution of
command.
A8 Aborted due to frame
length MAX error in
transmitted data during
execution of command.
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-292
7
7.7 Non-proc edure Mode Programming
7.7.1 Operating in Non-procedure Mode
Communications protocol
In non-procedure mode, the KV-L2 can be connected to an external device having
an RS-232C or RS-422A terminal to write a series of text data (100 bytes maximum)
into data memory as a batch and to send text data from data memory to a connected
device.
Setting of the communications protocol and connection of the KV-L2 to an external
device are described below.
Setting the operation mode
Set the operation mode using the operation mode setting switch SET A (A1 to A4).
Use A1 and A2 to set the mode for port 1, and A3 and A4 to set the mode for port 2.
Turn OFF the power switch before setting the operation mode.
Set the operation mode setting switch A1 to A4 as above.
Setting the communications protocols
Set the baud rate, data bit length, parity, and stop bit with communications protocol
setting switch SET B (B1 to B8) according to the specifications of the external device
to be connected. Turn OFF the power switch before setting the switches.
ON
OFF
A1 A2 A3 A4
Operation mode Port 1 Port 2
A1 A2 A3 A4
KV mode OFF OFF OFF OFF
Display Interface mode OFF ON OFF ON
Non-procedure mode ON ON ON ON
ON
OFF
B1 B2 B3 B4 B5 B6 B7 B8
B1 B2 B3 B4 B5 B6 B7 B8
Baud rate 1200 bits/s OFF OFF OFF OFF
2400 bits/s ON OFF OFF OFF
4800 bits/s OFF ON OFF OFF
9600 bits/s ON ON OFF OFF
19200 bits/s OFF OFF ON OFF
31250 bits/s ON OFF ON OFF
8400 bits/s OFF ON ON OFF
Setting disabled ON ON ON OFF
Parameters Data bits 7 bits OFF OFF
8 bits ON OFF
Parity None OFF OFF OFF
Odd ON OFF OFF
Even ON ON OFF
Stop bit 1 bit OFF OFF
2 bits ON OFF
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-293
1
7
Note 1: Communications protocols for devices to be connected must be identical;
otherwise, communication will fail. For the settings of the device to be connected,
refer to the operation manual supplied with the device.
Note 2: The communications protocol settings apply to both ports 1 and 2. The two
ports cannot be set to different protocols
Connecting to the KV-L2
When using port 1
When connecting the KV-L2 to a device with an RS-232C terminal, wire the RS-
232C cables as shown below.
Connect a commercially available RS-232C standard connection cable or null
modem cable to the RS-232C connector at port 1.
When using port 2
1. When using the KV-L2 port 2 set to RS-232C mode, wire the cable as shown
below.
2. When using the KV-L2 port 2 set to RS-422A mode, wire the cable as shown
below.
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
2
3
4
5
7
SD
RD
RS
CS
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DTE
External unit
designated as DCE
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
3
5
1
SD
RD
SG
KV-L2
3
5
1
SD
RD
SG
KV-L2
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DTE
2
3
4
5
6
20
7
SD
RD
RS
CS
DR
ER
SG
External unit
designated as DCE
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
KV-L2 terminal nos.
SDA
SDB
RDA
RDB
SG
SDA
SDB
RDA
RDB
SG
KV-L2 External unit
3
2
5
4
1
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-294
7
7.7.2 Assignment of Relay Nos. and Data Memory Address Nos.
The KV-L2 can be connected to a device with an RS-232C or RS-422A port to load
consecutive text data (100 bytes maximum) as a batch into its data memory and to
send text data from data memory.
Assigning relay nos. and data memory address nos.
Specify the first relay no. of the internal relays and, from the assigned data memory
addresses (DM9700 to DM9707), specify the first DM no. of the data memory
addresses for transmission/reception of text data.
Port nos. and assigned DM nos.
Ports 1 and 2 access the assigned DM addresses shown in the following table.
I Designating the first relay no.
Five relay nos., including the first relay no., are assigned.
Specify the starting relay no. of the channel (the relay no. with "00" as the two
least significant digits) as the first relay no. Even if a relay in the middle of the
channel is designated as the first relay, the starting relay of the channel becomes
the first relay
Example: When specifying 1710 as the first relay no., relay nos. 1700 to 1704 are
assigned.
When 0000 is specified as the first relay no., the following relay nos. are as-
signed.
KV-300 KV-L2
Text data
External unit
KV-L2 Port DM No. Designation
KV-L2 No. 1 Port 1 DM9700 First relay no.
DM9701 First DM no.
Port 2 DM9702 First relay no.
DM9703 First DM no.
KV-L2 No. 2 Port 1 DM9704 First relay no.
DM9705 First DM no.
Port 2 DM9706 First relay no.
DM9707 First DM no.
Port Relay nos. assigned
1 2400 to 2404
2 2500 to 2504
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-295
1
7
I Designating the first DM no.
200 DM nos., including the first DM no., are assigned.
Duplicating DM nos. already used in the program will disable normal data trans-
mission/reception.
Note 1: Two KV-L2s can be connected to the KV-300 CPU. The KV-L2s are defined
as No.1 and No. 2, counting from the module closest to the KV-300 CPU.
Note 2: The designated relays and DM addresses are set at startup of special utility
relay 2307.
Assigning relays
Five relay nos., including the first relay no., are assigned. The assigned relays have
the following functions.
1. First relay no. +0
Turns ON after data is loaded and transferred to data memory. It remains ON,
preventing data loading. Write a program to turn this relay OFF after the process is
completed. (Data is loaded while the relay is OFF.)
To fetch the ON signal only for one scan, add the following line to the end of the
program.
2. First relay no. +1
Turns ON and remains ON when the loaded data cannot be transferred to data
memory because the first relay no. +0 is ON when the data is received, or a parity
error has occurred (that is, first relay no. +2 was ON) during data reception.
When the data is loaded while the first relay no. +1 is ON, the first relay no. +1 turns
OFF when the first relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
3. First relay no. +2
Turns ON and remains ON when the data cannot be received because a parity error
has occurred during data reception. (The first relay +1 turned ON simultaneously.)
When the data is loaded while the first relay no. +2 is ON, the first relay no. +2 turns
OFF when the first relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
4. First relay no. +3
Turns ON when text data transmission starts. Automatically turns OFF after trans-
mission is completed. If it is forced OFF in the middle of a transmission, data
transmission is stopped immediately. Use the SET/RES instruction to turn the relay
ON/OFF.
The transmission/reception of text data is enabled while the special utility relay 2307
is ON.
Relay No. Function
First relay no. +0 ON when data has been loaded
+1 On when data has been loaded but not transferred to data memory
+2 On when a data reception error has occurred
+3 Data transmission start/stop ON: start, OFF: stop
+4 Transmits an approximately 160 msec break signal when turning ON.
(RES)

First relay no. +0) (
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-296
7
5. First relay no. +4
Turns ON when a break signal of approximately 160 msec is transmitted. Automati-
cally turns OFF after transmission is completed. Transmission is enabled while the
first relay no. +3 is OFF.
Use the SET instruction or KEEP instruction to turn the relay ON/OFF.
Assigning data memory addresses
200 DM addresses, including the first DM no., are assigned.
The assigned DM addresses have the following functions.
I Number of data bytes
The number of bytes in the first DM no. +0 and the first DM no. +100 becomes a
binary value. Write the binary data using the LDA/STA instruction or DW instruction.
I Text data
Enter the text data in ASCII, by byte per DM. ("00" is entered in the 8 high-order bits
and ASCII code is entered in the 8 low-order bits.)
Write the text data using the LDA/STA instruction or DW instruction.
DM No. Assigned data
First DM No. +0 Number of bytes of text data loaded
+1 to +99 Text data to be received
+100 Number of bytes of text data to be received
+101 to +199 Text data to be transmitted
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-297
1
7
7.7.3 Transmitting Text Data
This section describes transmission of text data in non-procedure mode.
The KV-L2 can transmit to an external unit the text data written to the assigned data
memory addresses, one byte per data memory address, in ASCII.
Data transmission and internal data memory addresses
Before starting communications, write the data to be transmitted into data memory
addresses in the following format.
"00" is loaded to 8 high-order bits and text data is loaded to 8 low-order bits, in
ASCII, as follows.
Use the LDA/STA instruction or DW instruction to write data into data memory.
ON/OFF status of special utility relays
The assigned special utility relays turn ON/OFF to transmit text data and a break
signal.
1. First relay no. +3
Turns ON when text data transmission starts. Automatically turns OFF after trans-
mission is completed. If it is forced OFF in the middle of a transmission, data
transmission is stopped immediately. Use the SET/RES instruction to turn the relay
ON/OFF.
The transmission/reception of text data is enabled while special utility relay 2307 is
ON.
2. First relay no. +4
Transmits a break signal of approximately 160 msec duration when turning ON.
Automatically turns OFF after transmission is completed. Transmission is enabled
while the first relay no. +3 is OFF.
Use the SET or KEEP instructions to turn the relay ON/OFF.
Note: Do not change the value of the text data (after the first DM +101) during
transmission, or an error will occur in the data being transmitted.
1st DM no.+100
Number of data bytes data 1 data 99
Data memory
addresses
Number
data 2 data 3 to data 98
1st DM no.+101 1st DM no.+102 1st DM no.+103 to 1st DM no. +198 1st DM no.+199
D15
0
D14
0
D13
0
D12
0
D11
0
D10
0
D09
0
D08
0
D07
0
D06
0
D05
1
D04
1
D03
0
D02
0
D01
0
D00
1
Data memory
High-order 8 bits Low-order 8 bits
[00] [ASCII code]
Relay No. Function
First relay no. Starts/ends text data transmission.
+3 ON: Start transmission OFF: End transmission
+4 Transmits a break signal of approximately 160 msec when turning ON.
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-298
7
7.7.4 Receiving Text Data
This section describes reception of text data in non-procedure mode. The KV-L2
fetches text data from an external unit into the KV-300 CPUs data memory.
Format of received data and data memory addresses
Text data of up to 100 bytes separated by the delimiter CR or CR LF can be written
into the assigned data memory addresses, one byte per data memory address, in
ASCII.
Reception data format
The KV-L2 can receive a maximum of 100 bytes of text data containing the delimiter
CR or CR LF in the last byte.
If transmitted text data includes CR, the KV-L2 transfers the data up to immediately
before CR to the data memory addresses. Text data after CR is loaded as separate
data.
Data memory addresses
The KV-300 can write received text data into the assigned data memory addresses,
one byte per data memory address, in ASCII.
00 is loaded to 8 high-order bits and text data is loaded to 8 low-order bits in ASCII
as follows.
ON/OFF status of special utility relays
The assigned utility relays turn ON only for the first scan when text data is loaded or
an error occurs.
1. First relay no. +0
Turns ON after loading data and transferring it to the data memory addresses. When
it remains ON, data cannot be loaded. Write a program so that this relay turns OFF
after the process is completed. (Data is loaded while the relay is OFF.)
To fetch the ON signal only for one scan, add the following line to the end of the
program.
C
R
Text data (100 bytes max.)
Last byte
or
C
R
L
F
data 1 data 2 data 3 data 99 - - - - - - - - - - -
data 1 data 99 data 2 data 3 to data 98
C
R
C
R
L
F
Received data
Data memory
addresses
Number
Number of data bytes
1st DM no.+00 1st DM no.+01 1st DM no.+02
Number of data bytes
1st DM no.+03 to 1st DM no.+98 1st DM no.+99
or
D15
0
D14
0
D13
0
D12
0
D11
0
D10
0
D09
0
D08
0
D07
0
D06
0
D05
1
D04
1
D03
0
D02
0
D01
0
D00
1
Data memory
High-order 8 bits Low-order 8 bits
[00] [ASCII code]
Relay No. Description
First relay +0 Turns ON when text data has been loaded.
+1 Turns ON when text data has been loaded but not transferred to DM.
+2 Turns ON when an error occurs during text data reception.
(RES)

First relay no. +0) (
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-299
1
7
2. First relay no. +1
Turns ON and remains ON when the loaded data cannot be transferred to data
memory because the first relay no. +0 is ON when the data is received, or a parity
error has occurred (that is, first relay no. +2 was ON) during data reception.
When the data is loaded while the first relay no. +1 is ON, the first relay no. +1 turns
OFF when the first relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
3. First relay no. +2
Turns ON and remains ON when the data cannot be received because a parity error
has occurred during data reception. (The first relay +0 turned ON simultaneously.)
When the data is loaded while the first relay no. +2 is ON, the first relay no. +2 turns
OFF when the first relay no. +0 turns ON.
To fetch the ON signal only for one scan, change the program as shown in 1. First
relay no. +0, above.
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-300
7
7.7.5 ASCII code/Binary Conversion Function
Besides ASC and RASC instructions, the KV-300 CPU has a function to convert a
character string in ASCII code to a binary value, and vice versa. This function helps
simplify programs that convert text data to binary values or binary values to text
data.
ASCII to Binary conversion
All text data fetched at reception can be converted to binary data at one time. To
convert ASCII code to a binary value, use data memory addresses DM9600 and
DM9601 and special utility relay 2314 as follows.
I Special utility relay 2314
Special utility relay 2314 converts an ASCII string for the scan when it turns ON and
transfers the converted data to data memory for the next scan.
For reception of a converted value, simplify the program by describing a loading
program prior to a conversion program through N.O. contact of 2314. ( Refer to
page 1-301.)
I Data memory address DM9600
The DM address into which the ASCII string is to be written is specified in DM9600.
For example, when specifying the data loaded upon reception of text data, the first
DM address +1 selected during assignment of data memory addresses ( Refer to
page 1-296) is written here.
I Data memory address DM9601
The first DM address in which a conveted binary data is written is specified in
DM9601. The converted binary uses three DM addresses, including the first DM
address described above.
Avoid using DM addresses already used by the program.
Set DM addresses to which ASCII code is to be written as follows.
I ASCII code length
The number of text data bytes loaded during reception of text data is set here. For
example, when a 4-byte ASCII code [30H 31H 32H 40H] is received, [4] is set.
I ASCII string
Text data is input byte by byte in ASCII for each data memory address. Within data
memory addresses, "00" is loaded to the high-order 8 bits and ASCII code is loaded
to the low-order 8 bits ( Refer to page 1-298).
The binary-converted value is loaded to data memory as follows.
2314 Turn ON to execute conversion (for one scan time).
DM9600 Write the first address of the data memory into which ASCII strings are
to be stored.
DM9601 Write the first address of the data memory addresses into which converted
binary values are to be written.
DM****+0 ASCII code length (text data bytes)
DM****+1 First value of ASCII string (data 1 of text data)
: :
DM****+99 Last value of ASCII string (data 99 of text data)
DM****+0 Binary high-order 16 bits
DM****+1 Binary low-order 16 bits
DM****+2 Decimal point (0: None, 1 to 99: DM position)
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-301
1
7
2804 2805 #09200
DW DW
#00000 2314
DM9600 DM9601
2315 Turn ON to execute conversion (for one scan time).
DM9602 Write the first address of the data memory to which the converted ASCII
strings are to be stored.
DM9603 Write the first address of the data memory into which a binary value to be
converted is loaded.
I Binary
A binary value is input to 16 high-order bits and 16 low-order bits in data memory
addresses separately. Binary data that can be converted ranges from -2147483647
to 2147483647 in decimal.
A space (20H) in ASCII is converted to 0 in binary.
Negative numeric values are represented as a 2s complement.
I Decimal position
The value of the decimal point represents the position of the data memory address
in which decimal point 2EH is stored, counting from the top of the ASCII string. For
example, if "38.5" is written to data memory as "33H 38H 2EH 35H" in ASCII, the
decimal point is in the third data memory position and "3" is set.
I ASCII to binary conversion program
The following example shows a program that converts text data loaded at reception
of text data to binary form. The converted value is written to data memory addresses
starting from DM0000.
Binary to ASCII conversion
To convert a binary value to an ASCII string, use data memory addresses DM9602
and DM9603 and special utility relay 2315 as follows.
I Special utility relay 2315
Special utility relay 2315 converts binary data during the scan when turning ON and
transfers the converted data to data memory for the next scan.
For reception of a converted value, simplify the program by describing a loading
program prior to a conversion program through N.O. contact of 2315.
Refer to page 1-303.
I Data memory address DM9602
The DM address into which the converted ASCII data is written is specified in
DM9602. For example, when the text data to be transferred is specified, the first DM
address +101 designated when data memory addresses are assigned ( Refer to
page 1-296) is written here.
I Data memory address DM9603
Write the first address of the data memory to which the binary data to be converted
is to be loaded. Binary data to be converted uses five DM addresses, including the
first DM address described above. Avoid using DM addresses already used by the
program.
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-302
7
DM****+0 Binary code high-order 16 bits
DM****+1 Binary code low-order 16 bits
DM****+2 Decimal position (0: None, 1 to 99: DM position)
DM****+3 No. of bytes in ASCII string
DM****+4 Sign (0: Unsigned, 1: Add - 2: Add )
DM****+0 First DM address of ASCII string (data 1 of text data)
: :
DM****+98 Last DM address of ASCII string (data 99 of text data)
Set the DM address into which ASCII code is to be written as follows.
I Binary
A binary value be converted is input to 16 high-order bits and 16 low-order bits in
data memory addresses separately.
I Decimal position
Specifies the decimal position written in the ASCII string. If 0, no decimal point is
specified.
After conversion, the ASCII code for decimal point (2EH) is stored in the specified
position counting from the top of the ASCII string. For example, when the binary
value is 1234 and decimal position is 2, the specified value becomes 1.234, which is
31H 2EH 32H 33H 34H in ASCII.
I Number of bytes in ASCII string
Specify the total number of bytes, including binary digits, +/- sign, and decimal point.
For example, when a value is -12.34, "6" is written here.
I Signs
Specify the +/- sign to be appended to the converted value (from binary to ASCII).
The +/- sign is stored in the first DM address of the ASCII string.
0: No sign
No +/- sign is appended to the ASCII-converted value. "0" can be specified when the
binary value is positive. If "0" is specified when a binary value is a 2s complement,
the binary is treated as a positive value.
1: - sign
Converts a binary value by giving -(2DH) when the binary value is a 2s complement.
Adds no sign to a positive binary.
2: sign
Converts a positive binary by giving +(2BH) and a negative binary (2s complement)
by giving -(2DH).
The ASCII-converted value is loaded to data memory addresses as follows.
The number of DM addresses used is the value specified as the number of bytes in
the ASCII string.
7.7 Non-procedure Mode Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-303
1
7
0000
2315
1000
1000
2807
2315 #09301 #00000
DIFU
SET ( )
< DW > < DW >
DM9602 DM9603
I Binary to ASCII conversion program
The following example shows a program that converts binary data to an ASCII string
during transmission of text data. The converted values are written to data memory
addresses starting from DM9301. The total number of digits, including the decimal
point, is written to DM9300.
7.8 Troubleshooting Guide KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-304
7
7.8 Troubleshooting Guide
7.8.1 Troubleshooting
KV-L2
Error Cause Remedy
POWER indicator
does not light.
The KV-300 CPU power switch
is not ON.
Supply 24 VDC power to the KV-
300 CPU.
Power supply capacity is
insufficient.
Check power supply capacity. If
capacity is insufficient, replace
power supply with one that
accommodates the current
capacity.
KV-L2 is not securely connected
to KV-300 CPU.
Remove KV-L2 from KV-300
CPU and reconnect it securely.
Communication is
disabled. (Port
operation indica-
tors do not light.)
Communication protocol is
incorrect.
Parity, data length, stop bit, and
baud rate of KV-L2 must corre-
spond to settings of external
device. Verify setting of communi-
cations protocol setting switch.
Transmission cable is not
connected.
Connect transmission cable.
Reception cable is not connected. Connect reception cable.
Mode setting is incorrect. Change mode setting to appro-
priate mode.
KV-L2 is not securely connected
to the KV-300 CPU.
Remove KV-L2 from KV-300
CPU and reconnect it securely.
Communication is
occasionally
disrupted.
Cables are not connected
securely.
Check cable wiring.
Cable is faulty. Replace cable.
In multi-drop mode, terminators
of stations at both ends are not
ON.
Set terminators of stations at
both ends to ON.
A strong noise source is located
near the system.
Isolate KV-300 CPU and cables
from noise source.
Power and connection cables
are in close proximity.
Isolate power cable from connec-
tion cable.
Unreadable data is
transmitted.
Communications protocol of KV-
L2 does not match that of
external device.
Parity, data length, stop bit, and
baud rate of KV-L2 must corre-
spond to settings of external
device. Verify setting of commu-
nications protocol switch.
A strong noise source is near
the system.
Isolate the KV-300 CPU and
cables from the noise source.
Power and connection cables
are in close proximity.
Isolate the power cable wiring
from connection cable wiring.
Station no. designation is
incorrect.
Transmit the correct station no.
Designated protocol includes an
error.
Add data to correct protocol as
designated.
7.8 Troubleshooting Guide KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-305
1
7
7.8.2 Precautions
Environmental requirements
When installing the KV-L2, note the following:
Avoid exposure to direct sunlight.
Avoid exposure to temperatures below 0C (32F) or exceeding 50C (122F).
Avoid exposure to humidity below 35%RH or exceeding 85%RH.
Avoid areas where condensation occurs due to sudden drops in temperature.
Avoid exposure to corrosive or flammable gases.
Avoid exposure to airborne dust, metal particles, oil, or corrosive substances
such as salt.
Avoid exposure to strong vibration or impact.
Avoid locations where water, oil, or chemicals may splash the KV-L2.
Avoid exposure to strong magnetic or electrical fields.
Panel installation
Consider accessibility and environmental resistance when installing the KV-L2 inside
a panel.
Ambient temperature
The operating temperature range of the KV-L2 is 0 to 50C (32 to 122F) (No freez-
ing).
Provide enough space for proper ventilation. If the temperature exceeds 50C
(122F), provide a fan or air conditioner.
Improving noise resistance
Do not install the KV-L2 and high voltage equipment in the same control panel.
Isolate the KV-L2 as far as possible from power cables.
Access
Isolate the KV-L2 as far as possible from high voltage equipment and drive equip-
ment in order to ensure safe and easy access for adjustment and maintenance.
Wiring
The KV-L2 terminal block includes M3.0 screws.
Use the following types of crimp terminals.
6.0 max.
6.0 max.
7.9 Specifications KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-306
7
7.9 Spec ific ations
7.9.1 Specifications
General specifications
Communications protocol
RS-232C connector specifications
RS-422A terminal block specifications
Model KV-L2
Power supply 24 VDC (supplied from KV-300 CPU)
Maximum current consumption 150 mA
Ambient temperature 0 to 50C (32 to 122F), No freezing
Relative humidity 35 to 85%, No condensation
Noise immunity 1500 Vp-p min., pulse width: 1 s and 50 ns
(Noise generated by noise simulator)
Vibration 10 to 55 Hz, double amplitude of 1.5 mm max.,
applied in each of X, Y, and Z directions (2 hrs)
Insulation resistance 50 M between power terminal and I/O terminal,
and external terminals and housing
(measured with 500 VDC megohmmeter)
Environmental restrictions No excessive dust or corrosive gas
Weight Approx. 190 g
Interface RS-232C/RS-422A
Duplex Full
Synchronization Start/stop
Baud rate 1200, 2400, 4800, 9600, 19200, 31250, 38400 bits/s
(switch selectable)
Data length 7 or 8 bits
Stop bit length 1 or 2 bits
Parity check Even, odd/None
Maximum transmission distance RS-232C: 15 m RS-422A: 500 m (total length)
D-Sub 25-pin
connector
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
Pin No. Description Signal abbreviation
2 Transmit data SD
3 Receive data RD
4 Transmit request RS
5 Transmission enabled CS
7 Signal ground SG
Terminal No. Description Signal abbreviation
1 Signal ground SG
2 Transmit data SDB
3 Transmit data SDA
4 Receive data RDB
5 Receive data RDA
SG
(SG)
SDB RDB
SDA
(SD)
RDA
(RD)
1 3 5
2 4
7.9 Specifications KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-307
1
7
7.9.2 Dimensions
Unit: mm
85
27. 3
35. 4
90
94
35
39. 4
7.10 Command List KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-308
7
7.10 Command List
7.10.1 List of Commands and Responses
Function Command Response Remarks
Starts communications CR_nn CC_nn nn = Station no. (00 to 09, 15)
Specify in decimal value
(not required for 1:1 connection)
Ends communications CQ CF
Changes mode of Mn OK n=0: PROGRAM mode
KV-300 CPU n=1: RUN mode
Error clear mode ER OK
Checks CPU error ?E dd dd: Error code (No error: 00)
Inquires model ?K K300
Checks current mode ?M 0 O: PROGRAM mode
1 1: RUN mode
Reads counter RD_Cnnn f,ddddd,ddddd f=0, 1
RD_CTHn (current value) (preset value) 0: contact OFF
RD_CTCn 1: contact ON
ddddd=00000 to 65535 (in decimal)
n/nnn=counter no.
Reads timer RD_Tnnn f,ddddd,ddddd f=0, 1
(current value) (preset value) 0: contact OFF
1: contact ON
ddddd=00000 to 65535 (in decimal)
nnnn=timer no.
Reads analog timer RD_AT ddddd_ddddd_00000_00000 ddddd=00000 to 00249 (in decimal)
(Trimmer 0) (Trimmer 1) Reads values of trimmers 0 and 1.
Changes current value* WR_Cnnn_ddddd OK n/nnn: counter/timer no.
of timer/counter WR_CTHn_ddddd ddddd=00000 to 65535 (in decimal)
WR_Tnnn_ddddd
Changes preset value WS_Cnnn_ddddd OK n/nnn: counter/timer no.
of timer/counter WS_CTCn_ddddd ddddd=00000 to 65535 (in decimal)
WS_Tnnn_ddddd
Reads relay contact RD_nnnnn 0 0: contact OFF
1 1: contact ON
Forces contact ON ST_nnnnn OK nnnnn=relay no.
ST_Cnnn nnn=counter/timer no.
ST_Tnnn
Forced contact OFF RS_nnnnn OK nnnnn=relay no.
RS_Cnnn nnn=counter/timer no.
RS_CTCn n=high speed counter comparator no.
RS_Tnnn
Reads DM RD_DMnnnn ddddd ddddd=00000 to 65535 (in decimal)
Writes into DM WR_DMnnnn_ddddd OK ddddd=00000 to 65535 (in decimal)
nnnn=DM no.
Reads TM RD_TMnn ddddd ddddd=00000 to 65535 (in decimal)
nn=TM no.
Writes into TM WR_TMnn_ddddd OK ddddd=00000 to 65535 (in decimal)
nn=TM no.
List of commands and responses used for serial communications in KV mode
Note 1: An underscore (_) in the command represents a space.
Note 2: M30 and TM31 are read-only memories; values cannot be written to them.
* The "WS" command changes the content of the program stored in the PLC's EEPROM. Contact if you
need to change it frequently.
7.10 Command List KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-309
1
7
7.10.2 List of Commands and Responses in Display
Interface mode
Format of command and response
FCS @
C
R Station no.
Header
code
Command/response
Range of station no.: 00 to 15
Command Response
Header Function Header Command data Header Response
code code code data
RR Read I/O relay/internal utility relay RR Read start ch. RR End code
Number of channels Data read
to read
RH Read temporary memory/analog timer RH Read start no. RH End code
Number of timers Data read
to read
RC Read current value of counter/timer/high-speed RC Read start no. RC End code
counter Number of counters/ Data read
timers to read
RG Read status of counter/timer/high-speed counter RG Read start no. RG End code
comparator Number of counter/ ON/OFF
timer/comparator to information
read
RD Read DM RD Read start DM no. RD End code
Number of DM Data read
addresses to read
RJ Read I/O relay/internal utility relay RJ Read start ch. RJ End code
Number of channels Data read
to read
WR Forced update of I/O relay/internal utility relay WR Write start ch. WR End code
Data to write
WH Update temporary memory WH Write start ch. WH End code
Data to write
WC Update current value of counter/timer/high-speed WC Write start no. WC End code
counter Data to write
WG Forced update of status of counter/timer/high- WG Write start no. WG End code
speed counter comparator Data to write
WD Update DM value WD Write start no. WD End code
Data to write
WJ Forced update of I/O relay/internal utility relay WJ Write start ch. WJ End code
Data to write
R# Read set value of counter/timer/high-speed R# Instruction word R# End code
counter comparator Operand Set value
W# Update set value of counter/timer/high-speed W# Instruction word
counter comparator Operand
New set value W# End code
MS Read KV-300 CPU operation mode MS MS End code
Operation
mode
SC Change KV-300 CPU operation mode SC Operation mode SC End code
KS Set KS Device Changed no. KS End code
Changed bit
KR Reset KR Device KR End code
No. to change
Bit to change
7.10 Command List KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 7 KV-L2 Serial Interface Module
1-310
7
Command Response
Header Function Header Command data Header Response data
code code code
FK Set/reset multiple channels FK Device FK End code
No. to change
Data to forceset/
reset
CR Read values of DM0008 to DM0015 CR CR End code
Data of DM0008 to
DM0015
MM Read model code MM MM End code 13
TS Test TS Any characters TS Any characters
(122 characters (122 characters
max.) max.)
QQMR Register combined commands and QQMR Device ch. no. QQMR End command
monitor I/Os Operand
QQIR Read combined commands and QQIR QQIR End code
monitor I/Os Data read from
registered table
XZ Abort XZ No response
** Initial ** (No station no. No response
or FCS)
IC Command undefined error No command IC
Command execution disabled Header End code
code
Chapter 8
KV-AN6 Analog I/O Module
This chapter describes the optional Analog I/O module for KV-300 Series.
8.1 Outline ...................................................................................... 1-312
8.2 Configuration ........................................................................... 1-313
8.2.1 Parts and Functions .............................................................................. 1-313
8.2.2 System Configuration ............................................................................ 1-314
8.3 Installation ................................................................................ 1-315
8.3.1 Terminal Nos. ........................................................................................ 1-315
8.3.2 Removing the Terminal Block ............................................................... 1-316
8.3.3 Example of Voltage I/O Wiring .............................................................. 1-317
8.3.4 Example of Current I/O Wiring .............................................................. 1-318
8.3.5 Setting I/O Ranges ................................................................................ 1-319
8.4 Programming ........................................................................... 1-320
8.4.1 Input Characteristics (A/D) .................................................................... 1-320
8.4.2 Calculating Input Data (A/D) ................................................................. 1-321
8.4.3 Output Characteristics (D/A) ................................................................. 1-322
8.4.4 Calculating Output Data (D/A) ............................................................... 1-323
8.4.5 Assigning Data Memory (DM) Addresses ............................................. 1-324
8.4.6 Reading Analog Input ............................................................................ 1-325
8.4.7 Measuring Analog Input Average .......................................................... 1-326
8.4.8 Writing Analog Output ........................................................................... 1-327
8.4.9 Converting Analog Input to Analog Output ............................................ 1-328
8.5 KV-AN6 Appendices ................................................................ 1-329
8.5.1 Troubleshooting .................................................................................... 1-329
8.5.2 Precautions ........................................................................................... 1-330
8.5.3 Specifications ........................................................................................ 1-331
8.5.4 Dimensions ........................................................................................... 1-332
K
V
-
3
0
0
K
V
-
1
0
/
8
0
KV-300 Series Only
8.1 Outline KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-312
8
8.1 Outline
Features
The KV-AN6 has both A/D and D/A conversion functions. The A/D conversion
function converts analog input to digital data and stores the converted data in the
KV-300 CPU; the D/A conversion function converts digital data stored in the KV-300
CPU to analog output data for output devices.
A/D converter
Converts analog input to 16-bit binary data (digital data). (The effective bits are the
12 bits starting from the most significant digit.)
Three input ranges can be selected with a slide switch: -10 to +10 V (voltage), -5 to
+5 V (voltage), and 0 to 20 mA (current).
Each KV-AN6 module has 4 input channels.
D/A converter
Converts 16-bit binary data (digital data) to analog output. (The effective bits are the
12 bits starting from the most significant digit.)
Three output ranges can be selected with a slide switch: -10 to +10 V (voltage), -5 to
+5 V (voltage), and 4 to 20 mA (current).
Each KV-AN6 module has two output channels.
Note: As shown below, 12 bits of the 16-bit binary data, starting from the most
significant digit, are effective.
(4ch)
10V
5V
0 to 20mA
KV-AN6
M
M
Temperature
Pressure
Flow rate
Speed
T
r
a
n
s
d
u
c
e
r
P
r
e
a
m
p
i
f
i
e
r
A/D
convertor
KV-300
CPU
12 bits 12 bits
Temperature control
Inverter
Servo
controller
Temperature
recorder
Analog
regulator
Speed control motor
Position control motor
Voltage
Current
Power
Power factor
D/A
convertor
(2ch)
10V
5V
4 to 20mA
D15
0
D14
1
D13
1
D12
1
D11
1
D10
1
D09
0
D08
1
D07
0
D06
0
D05
0
D04
0
D03
X
D02
X
D01
X
D00
X
These 12 bits are effective. Undefined
8.2 Configuration KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-313
1
8
8.2 Configuration
8.2.1 Parts and Functions
5V 10V
5V 10V 0~20mA
CH4
D
/
A
CH5 CH1
D
/
A
CH2
CH0
CH3
2
4
1
3
5
Note 1: To remove the terminal block, refer to page 1-316.
Note 2: To use analog current output (4 to 20 ms), a terminal separated from the
analog voltage output terminals is required.
No. Part name Function
1 READY indicator Lights when power (24 VDC) is supplied to the
KV-AN6.
2 Analog I/O terminal block Removable terminal block for analog input
signals (4 ch.) and analog output signals (2 ch.)
3 Terminal block lock bar Lock mechanism used to lock/release the
analog I/O terminal block
4 Input range selection switch Selects the analog input range for A/D conver
sion. Provided for each channel.
(White represents the switch position.)
5 Output range selection switch Selects the analog output range for D/A conver
sion. Provided for each channel.
(White represents the switch position.)
5V 10V 0 to 20mA
5V 10V
8.2 Configuration KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-314
8
8.2.2 System Configuration
The following example shows the configuration of a system incorporating the KV-
AN6. Up to five KV-AN6 modules can be connected simultaneously to the KV-300
CPU. Place the KV-AN6 at the right end of the system.
The following figure shows a sample connection of KV-AN6 modules.
Refer to page 1-324 or assignment of data memory addresses.
Note: If five KV-AN6 modules are connected to the KV-300 CPU, two KV-L2
modules and six I/O modules can be connected.
KV-300 CPU
KV-AN6
(5 modules max.)
I/O modules
(11 modules max.)
KV-U4
8.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-315
1
8
8.3 Installation
8.3.1 Terminal Nos.
The following signals are assigned to the terminal nos. of the KV-AN6.
KV-AN6
Signals
Note: Voltage output and current output can be used simultaneously.
0
1
2
3
V4
I4
V5
I5
C0
C1
C2
C3
C4
C5
C6
C7
F.G.
D
/
A
A
/
D
Terminal No. Description Assigned signal
0 A/D Analog input ch. 0 (10 V, 5 V, 0 to 20 mA)
Input range is slide-switch
selectable.
1 Analog input ch. 1
2 Analog input ch. 2
3 Analog input ch. 3
V4 D/A Analog voltage
output ch. 4
(10 V, 5 V) Input range is
slide-switch selectable.
I4 Analog current
output ch. 4
4 to 20 mA output range
V5 Analog voltage
output ch. 5
(10 V, 5 V) Input range is
slide-switch selectable.
I5 Analog current
output ch. 5
4 to 20 mA output range
. Not used NC
C0
C1
C2
C3
C4
C5
C6
C7
F.G.
Analog GND (common)
Frame ground
8.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-316
8
8.3.2 Removing the Terminal Block
To remove the terminal block from the KV-AN6 module, do the following.
1. Turn OFF the power switch. Open the terminal block cover from the top as
shown below.
2. The terminal block is secured with a lock bar as shown below.
3. Remove the terminal block by pushing the terminal block lock bar to release the
terminal block.
Turn OFF the power switch before removing the terminal block.
Terminal block lock bar
Open
CAUTION
Terminal block lock bar
Remove the terminal block
Push the lock bar
8.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-317
1
8
8.3.3 Example of Voltage I/O Wiring
I Voltage output unit
Note 1: Use a two-core twisted pair shielded cable as the analog signal cable.
Note 2: Isolate the analog signal cable wiring from the AC cable wiring including
power cables.
Note 3: Connect a shielding wire or shielded cable to the input side for analog input,
and to the load side for analog output. It may be better to connect a shielding wire or
shielded cable to C0 to C7, depending on the case.
0
1
2
3
V4
I4
V5
I5

C0
C1
C2
C3
C4
C5
C6
C7
F.G.
+
_
+

Voltage signal
ch. 0
Voltage signal
ch. 1
Voltage signal
ch. 2
Voltage signal
ch. 3
(Input)
A/D converter
Analog signal cable
Shield
Shield
Shield
Shield
Analog signal
cable
Shield
Shield
(Load)
Voltage signal
ch. 4
Voltage signal
ch. 5
D/A converter
8.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-318
8
8.3.4 Example of Current I/O Wiring
I Current output unit
Note 1: Use a two-core twisted pair shielded cable as the analog signal cable.
Note 2: Isolate the analog signal cable wiring from the AC cable wiring including
power cables.
Note 3: Connect a shielding wire or shielded cable to the input side for analog input,
and to the load side for analog output. It may be better to connect a shielding wire or
shielded cable to C0 to C7, depending on the case.
Current signal
ch. 0
0
1
2
3
V4
I4
V5
I5

C0
C1
C2
C3
C4
C5
C6
C7
F.G.
+

Current signal
ch. 1
Current signal
ch. 2
Current signal
Ch.3
(Input)
Analog signal cable
Shield
Shield
Shield
Shield
Analog signal
cable
Shield
Shield
(Load)
Current signal
ch. 4
Current signal
ch. 5
A/D converter
D/A converter
8.3 Installation KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-319
1
8
8.3.5 Setting I/O Ranges
This section describes how to set the KV-AN6 I/O ranges.
As shown in the following figure, the analog input (A/D) range and analog output (D/
A) range can be selected with the slide switches on the right side of the KV-AN6
module.
The I/O ranges are factory-set to 5 V.
Analog input (A/D) range Analog output (D/A) range
Selection Setting Selection Setting
switch switch
Voltage input: -5 to +5 V Voltage output: -5 to +5 V
Voltage input: -10 to +10 V Voltage output: -10 to +10 V
Current input: 0 to 20 mA Connecting Current output: 4 to 20 mA
terminal for
current output
CAUTION
10V 0 to 20 mA 5V
5V 10V
Analog output range (D/A)
selection switch
Analog input range (A/D)
selection switch
KV-AN6
module
CH0
CH1
CH4
CH5
CH2
CH3
A
/
D
D
/
A
Turn OFF the power switch before changing selection switch settings.
Analog input signals must fall within the range set by the selection switch.
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-320
8
8.4 Programming
8.4.1 Input Characteristics (A/D)
On the KV-AN6, the analog input function converts analog signals from an external
unit to digital signals. The converted data is written into the assigned data memory
addresses at every scan time.
An external analog input signal can be set according to the input range, as shown in
the following table.
The selection switches in the above table are located on the right side of the KV-
AN6 ( Refer to page 1-319).
Voltage input
Current input
Through the A/D converter, analog input signals are written as binary data (16 bits)
into the assigned data memory addresses by channel ( Refer to page 1-324). The
effective bits are the 12 bits starting from the most significant digit.
When a signal beyond the setting range is input, it is converted to 7FFFH at positive
voltage and 8000H at negative voltage. For example, if +10 V is input when input
range is set to 5 V, it is digitally converted to 7FFFH.
2
0
4 6 8 10
-6400
-12800
-19200
-25600
(8300H) -32000
(7D00H) +32000
+25600
+19200
+12800
+6400
(mA) 12 14 16 18 20
(Digital-converted value)
(0 to 20 mA range)
(Analog input value)
(Digital-converted value)
+2
0
+4 +6 +8 +10 -2 -4 -6 -8
-6400
-12800
-19200
-25600
-32000 (8300H)
(7D00H) +32000
+25600
+19200
+12800
+6400
-5
+5
(V) -10
(5 V range)
(10 V range)
(Analog input value)
Selection Description Range
switch
Voltage input -5 to +5 V
-10 to +10 V
Current input 0 to 20 mA
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-321
1
8
Full scale and resolution of each range
(12-bit BIN data)
Negative input data is treated as a 2s complement.
Maximum value (+10 V, +5 V, 20 mA)
Minimum value (-10 V, -5 V, 0 mA)
(4 mA)
8.4.2 Calculating Input Data (A/D)
The KV-AN6 converts analog input signals to 16-bit digital values and writes them
into data memory. (The effective bits are the 12 bits starting from the most signifi-
cant digit.)
This section describes how to convert the data stored in data memory into digital
data (in decimal) according to the input range.
Full scale and resolution of each range
The following table shows the full scale and resolution of each range.
Since the effective bits that are written into data memory are the 12 bits starting
from the most significant digit, resolution is 1/4000 of the full-scale value.
To calculate the input voltage value or input current value from the data written
into data memory, use the following expressions:
Input voltage = DM value/16 x Resolution of the input range
Input current = (32000 + DM value)/16 x Resolution of the input range
To convert a 16-bit DM value to an effective 12-bit value, divide the 16-bit value
by 16.
Example 1
When 19200 (in decimal) is written into DM addresses in the 10 V range
19200/16 x 5 mV = 6000 mV = 6 V
The KV-AN6 receives input of +6 V.
Example 2
When 12800 (in decimal) is written into DM addresses in the 5 V range
12800/16 x 2.5 mV = 2000 mV = 2 V
The KV-AN6 receives input of 2 V.
Example 3
When 16000 (in decimal) is stored in DM addresses in the 0-to-20 mA range
(32000 + 16000)/16 x 5 A = 15000 A = 15 mA
The KV-AN6 receives input of +15 mA.
D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00
0 0 0 0
Sign bit
0: Positive
1: Negative
Hexadecimal Hexadecimal
Hexadecimal
Undefined
Data memory
addresses
Undefined
D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00
0 1 1 1 1 1 0 1 0 0 0 0 X X X X
7 D 0
Undefined
D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00
1 0 0 0 0 0 1 1 0 0 0 0 X X X X
8 3 0
Range Full scale Resolution
10 V 20 V 5 mV
5 V 10 V 2.5 mV
0 to 20 mA 20 mA 5 A
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-322
8
8.4.3 Output Characteristics (D/A)
On the KV-AN6, the analog output function converts digital (binary) data to analog
external output signals. The digital data stored in data memory is converted to
analog data and sent to an output unit at every scan time.
The analog output signal can be set according to the input range as shown in the
following table.
The selection switches in the table are located on the right side of the KV-AN6.
Refer to page 1-319.
Voltage output
Selection switch Description Range
Voltage output -5 to +5 V
-10 to +10 V
Connected to terminal for current output Current output 4 to 20 mA
(Analog output value)
Current output
Through the D/A converter, digital data stored in the assigned data memory ad-
dresses by channel (Refer to page 1-324) is output as analog signals. The effective
bits are the 12 bits starting from the most significant digit.
Note: A change in the value of the DM address from 7FFFH (32767) to 8000H
(32768) or vice versa means that the polarity is reversed when the voltage output is
selected, or that output drastically changes from the maximum value to the minimum
value or vice versa when the current output is selected. Use the program to maintain
output data within the specified range.
0
10
8
6
4
2
-
3
2
0
0
0
(
8
3
0
0
H
)
-
2
5
6
0
0
-
1
9
2
0
0
-
1
2
8
0
0
-
6
4
0
0
6
4
0
0
1
2
8
0
0
1
9
2
0
0
2
5
6
0
0
(
7
D
0
0
H
)
3
2
0
0
0
-2
-4
-6
-8
-10
(V)
2
6
4
0
0
1
2
8
0
0
1
9
2
0
0
2
5
6
0
0
3
2
0
0
0
-
3
2
0
0
0
-
2
5
6
0
0
-
1
9
2
0
0
-
1
2
8
0
0
-
6
4
0
0
(mA)
6
8
10
12
14
16
18
20
0
4
(10 V range)
(5 V range)
(Digital data)
(Analog output value)
(4-to-20 mA range)
(Digital data)
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-323
1
8
8.4.4 Calculating Output Data (D/A)
To output analog data, write the data into the analog output data memory ad-
dresses.
Calculate the numerical value to be written into data memory.
Voltage output
DM value = Output voltage/Output range resolution x 16
Current output
DM value = (Output current -12 [mA])/0.004 [mA] x 16
To convert a 16-bit DM value to an effective 12-bit value, multiply the 16-bit value
by 16.
Example 1
When +7.5 V is output in the 10 V range
7.5 V/5 mV x 16 = 24000
The DM value is 24000.
Example 2
When -5 V is output in the 5 V range
5 V/2.5 mV x 16 = 32000
Since the output voltage in this example is negative, set the result by subtracting
32000 from 0 as the DM value.
Example 3
When 18 mA is output in the 4-to-20 mA range
(18 mA - 12 mA)/0.004 x 16 = 24000
The DM value is 24000.
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-324
8
8.4.5 Assigning Data Memory (DM) Addresses
The data memory address assignment is predefined by each A/D and D/A
channel.
Analog input is converted to 16-bit digital data (in binary) and stored in the data
memory addresses assigned for the A/D conversion.
To convert analog data for output, write 16-bit digital data (binary) into the data
memory addresses assigned for the D/A conversion.
DM address assignment list
The KV-AN6 modules are numbered sequentially starting with the one closest to the
KV-300 CPU.
Module No. Description DM Channel R: read
W: write
1 A/D DM9000 Analog input ch. 0 R
DM9001 Analog input ch. 1
DM9002 Analog input ch. 2
DM9003 Analog input ch. 3
D/A DM9004 Analog output ch. 4 W
DM9005 Analog output ch. 5
2 A/D DM9006 Analog input ch. 0 R
DM9007 Analog input ch. 1
DM9008 Analog input ch. 2
DM9009 Analog input ch. 3
D/A DM9010 Analog output ch. 4 W
DM9011 Analog output ch. 5
3 A/D DM9012 Analog input ch. 0 R
DM9013 Analog input ch. 1
DM9014 Analog input ch. 2
DM9015 Analog input ch. 3
D/A DM9016 Analog output ch. 0 W
DM9017 Analog output ch. 1
4 A/D DM9018 Analog input ch. 0 R
DM9019 Analog input ch. 1
DM9020 Analog input ch. 2
DM9021 Analog input ch. 3
D/A DM9022 Analog output ch. 0 W
DM9023 Analog output ch. 1
5 A/D DM9024 Analog input ch. 0 R
DM9025 Analog input ch. 1
DM9026 Analog input ch. 2
DM9027 Analog input ch. 3
D/A DM9028 Analog output ch. 4 W
DM9029 Analog output ch. 5
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-325
1
8
8.4.6 Reading Analog Input
The following example describes how to read analog input.
Example
This program reads data from analog input ch. 0 of the KV-AN6 module no. 1, and
writes positive data into DM0000 and negative data into DM0001. (The data value
up to the second decimal position is written.)
Input range of 10 V is used.
Input of +10 V is stored as 1000 into DM0000, and input of -10V is stored as 1000
into DM0001 (data value x 100).
Ladder diagram
For assignment of data memory addresses, refer to page 1-324.
Example
I Conversion tip
Conversion from hexadecimal data to decimal data
Example: Convert 7D00H (in hexadecimal) to a decimal value
7 x 16 3 + D x 16 2 + 0 x 16 1 + 0 x 16 0 = 28672 + 3328 + 0 + 0 = 32000
(in decimal)
2002 2009 DM9000
LDA
$8000
CMP
2009
COM
#00001
ADD
#00016
DIV
DM0001
STA
#00005
MUL
DM0000
STA
>
<
#00016
DIV
#00005
MUL
DM9000
Analog input:
KV-AN6
module no. 1,
input ch. 0
Result of
$8000
When analog input is positive
DM9000/#16 x 5 mV > DM0000
When analog input is negative
(Reversed bit of DM9000 + #1)/#16 x 5 mV > DM0001
Analog input

Analog input +10 V (10 V range)


D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00
0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0
7 D 0 0
DM9000 data
32000
32000/16 x 5 = 10000 > Written into DM0000.
10.000 V (Up to the third decimal position)
Convert to decimal:
Analog input -10 V (10 V range)
32000/16 x 5 = 10000 > Written into DM0001.
10.000 V (Up to the third decimal position)

8.4 Programming KV-300 Series Only


K
V
-
3
0
0
K
V
-
1
0
/
8
0
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.
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-327
1
8
8.4.8 Writing Analog Output
The following example describes how to write analog output.
Example 1
Output the data written into DM0000 to analog output ch. 1 of the KV-AN6 module
No. 1 (10 V output range)
When input 0000 is ON, +10 V is output.
When input 0000 is OFF, -10 V is output.
Ladder diagram
Example 2
Input trimmer variable data by using analog timer ch. 0 of the KV-300 CPU and
output voltage to analog output ch. 1 of the KV-AN6 module no. 1.
When input 0000 is ON ( 0 to 10 V), voltage increases when trimmer of analog
timer is turned clockwise.
When input 0000 is OFF (0 to -10 V), voltage decreases when trimmer is turned
clockwise.
Output range of 10 V is used.
Ladder diagram
Trimmer input
Variable from 0 to
32000
Trimmer variable (0
to 32000)
0 to 10 V
When input 0000 is
ON, outputs 0 to 10 V
to analog output ch.
1.
When input 0000 is
OFF, outputs 0 to -
10 V to analog
output ch. 1.
2002 0
TMIN
#00100
MUL
DM0000
STA
#00320
MUL
#00249
DIV
0000 DM0000
LDA
DM9004
STA
0000 DM0000
LDA COM
#00001
ADD
DM9004
STA
Inputs 10 V to
DM0000.
2002
0000 DM0000
LDA
#01000
MUL
#00005
DIV
#00016
MUL
DM9004
STA
0000 DM0000
LDA
#01000
MUL
#00005
DIV
#00016
MUL COM
DM9004
STA
#00001
ADD
#00010
DW
DM0000
When input 0000 is
ON, outputs +10 V
from ch. 1.
When input 0000 is
OFF, outputs -10 V
from ch. 1.
8.4 Programming KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-328
8
8.4.9 Converting Analog Input to Analog Output
The following example describes how to fetch analog input and output it as analog
data.
Example
Fetch signals from analog input ch. 0 of the KV-AN6 module no. 1 and output the
signals as analog data to analog output ch. 4.
Select either voltage-to-current conversion or current-to-voltage conversion, using
the range selection switches. For the range setting, refer to page 1-319.
Ladder diagram
Fetches analog input
and outputs it as
analog data.
2002 DM9000
LDA
2002 2009 DM9000
LDA
$8000
CMP
2009
COM
#00001
ADD
#00016
DIV
DM0001
STA
#00016
DIV
DM0000
STA
DM9004
STA
#00005
MUL
#00005
MUL
For assignment of data memory addresses, refer to page 1-324.
When analog input is
positive, writes the
data value x 1000 into
DM0000.
(In the diagram) Let
the complement of
two be true.
When analog input is
negative, writes the
data value x 1000 into
DM0001.
8.5 KV-AN6 Appendices KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-329
1
8
8.5 KV-AN6 Appendic es
8.5.1 Troubleshooting
When an analog input/output error occurs, determine the error and remedy with the
following flowchart.
Analog input/output
is disabled.
Is READY
indicator ON?
OFF
ON Is KV-U4/U5
POWER
indicator ON?
OFF
Check KV-U4 power
supply unit or KV-U5
power distribution module.
ON
Check for secure
connections between
modules.
Check contact with
analog I/O terminal
block.
Is analog input/
output enabled?
YES
NO
Check analog input/
output and I/O channel
setting.
YES
NO
Is analog input
enabled?
Is analog input/
output enabled?
YES
NO
Check data in data
memory address on
status monitor with the
KV-P3E(01) (Handheld
Programmer).
YES
NO
Can you
monitor
the data?
YES
Check the
KV-300 CPU
program.
End
Write data into data
memory addresses
with the KV-P3E(01)
(Hand-held Programmer)
to verify that analog
output is enabled.
Is analog output
enabled?
NO
Contact nearest
KEYENCE office.
8.5 KV-AN6 Appendices KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-330
8
8.5.2 Precautions
Environmental requirements
When installing the KV-AN6, note the following:
Avoid exposure to direct sunlight.
Avoid exposure to temperatures below 0C (32F) or exceeding 50C (122F).
Avoid exposure to humidity below 35%RH or exceeding 85%RH.
Avoid areas where condensation occurs due to sudden drops in temperature.
Avoid exposure to corrosive or flammable gases.
Avoid exposure to airborne dust, metal particles, oil, or corrosive substances
such as salt.
Avoid exposure to strong vibration or impact.
Avoid locations where water, oil, or chemicals may splash the KV-AN6.
Avoid exposure to strong magnetic or electrical fields.
Panel installation
Consider accessibility and environmental resistance when installing the KV-AN6
inside a panel.
Ambient temperature
The operating temperature range of the KV-AN6 is 0 to 50C (32 to 122F) (No
freezing).
Provide enough space for proper ventilation.
if the temperature exceeds 50C (122F), provide a fan or air conditioner.
Improving noise resistance
Do not install the KV-AN6 and high-voltage equipment in the same control panel.
Isolate the KV-AN6 as far as possible from power cables.
Access
Isolate the KV-AN6 as far as possible from high voltage equipment and drive
equipment to ensure safe and easy access for adjustment and maintenance.
Wiring
The KV-AN6 terminal block includes M3.0 screws.
Use the following types of crimp terminals.
6.0 max. 6.0 max.
8.5 KV-AN6 Appendices KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-331
1
8
8.5.3 Specifications
Environmental specifications
System specifications
Model KV-AN6
Maximum current consumption 240 mA
Ambient temperature 0 to 50 C (32 to 122F), No freezing
Relative humidity 35 to 85%, No condensation
Noise immunity 1500 Vp-p min., pulse width: 1 s and 50 ns
(Noise generated by noise simulator)
Vibration 10 to 55 Hz, double amplitude of 1.5 mm max., applied
in each of X, Y, and Z directions (2 hrs)
(1 G when attached to a DIN rail)
Insulation resistance 50 M between power terminal and I/O terminal, and
external terminals and housing (measured with 500
VDC megohmmeter)
Environmental restrictions No excessive dust or corrosive gas
Weight Approx. 200 g
Note: The A/D and D/A converters can be used simultaneously.
A/D specifications D/A specifications
Analog input Voltage 10 V Analog output Voltage: 10 V
(switch selectable) 5 V (voltage output: switch 5 V
Current: 0 to 20 mA
selectable; current output:
Current: 4 to 20 mA
use separated terminal)
Input impedance Voltage: 1 M Output impedance Voltage: 100
Current: 350 Max. load resistance Current: 400
Analog input channels 4 channels Analog output channels 2 channels
Resolution 10 V 5 mV (1/4000) Resolution 10 V 5 mV (1/4000)
5 V 2.5 mV (1/4000) 5 V 2.5 mV (1/4000)
0 to 20 mA 5 mA (1/4000) 4 to 20 A 4 A (1/4000)
Digital data format 16-bit binary, 2s complement
Effective bits are the 12 bits starting from the most significant bit.
Total accuracy 1% of full scale
Conversion rate 720 s/4 ch Conversion rate 360 s/2 ch
Isolation method Photocoupler: Not isolated between channels or between A/D and D/A converters
Absolute input Voltage: 12 V max.
Current: 30 mA max.
8.5 KV-AN6 Appendices KV-300 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 8 KV-AN6 Analog I/O Module
1-332
8
90
94
35
39. 4
84. 5
27. 3
35. 4
8.5.4 Dimensions
Unit: mm
Chapter 9
KV-AD4/DA4 Analog I/O Unit
This chapter describes the optional Analog I/O unit for KV-10/80 Series.
Note: KV-AD4/DA4 is available for KV-10/80 Series only.
9.1 Outline ...................................................................................... 1-334
9.2 Configuration ........................................................................... 1-335
9.2.1 Part Names and Functions.................................................................... 1-335
9.2.2 Specifications ........................................................................................ 1-337
9.2.3 System Configuration ............................................................................ 1-341
9.3 Installation ................................................................................ 1-342
9.3.1 Installation Procedure ........................................................................... 1-342
9.3.2 Checking the Installation Environment .................................................. 1-343
9.3.3 Setting the KV-AD4 Input Mode ............................................................ 1-344
9.3.4 Connecting External Instruments .......................................................... 1-345
9.3.5 Connecting to the KV-10 to 80 .............................................................. 1-348
9.3.6 Maintenance.......................................................................................... 1-349
9.4 Programming ........................................................................... 1-350
9.4.1 Programming the KV-AD4..................................................................... 1-350
9.4.2 Programming the KV-DA4..................................................................... 1-353
9.4.3 A/D and D/A Conversion Tables ........................................................... 1-357
9.5 Programming Examples .......................................................... 1-359
9.6 Troubleshooting ...................................................................... 1-370
K
V
-
3
0
0
K
V
-
1
0
/
8
0
KV-10/80 Series Only
9.1 Outline KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-334
9
9.1 Outline
Features
The KV-AD4 is provided with an A/D conversion function, while the KV-DA4 is
provided with a D/A conversion function.
A/D Conversion KV-AD4
Analog data that is input from external instruments is converted to digital data, and
written to CPU data memory. Conversion of analog data to digital data allows the
analog data to be processed on the CPU.
For details, see "Part Names and Functions" on the next page.
D/A Conversion KV-DA4
The digital data that is written to CPU data memory is converted to analog signals,
and output to external instruments. Conversion of digital data after it has been
processed by the CPU to analog data allows information to be sent to instruments
such as temperature recorders or analog controllers that handle analog data.
For details, see "Part Names and Functions" on the next page.
DIPSW1 DIPSW2
ON
Status
OFF
CH0, CH1 -10 to +10 V CH0, CH1 4 to 20 mA
CH2, CH3 -10 to +10 V CH2, CH3 4 to 20 mA
Analog signals can be output to up to four (4 channels) external instruments.
Two output ranges are provided for each channel, and can be selected on the
terminal block.
N Voltage: -10 to +10 V N Current: 4 to 20 mA
Power
supply
unit
D/A
converter
CPU KV-DA4
Data
Memory
Writing digital data
Servo motor controller
Inverter
Temperature recorder
Analog controller
Analog
signals
output
Power
supply
unit
A/D
converter
KV-AD4 CPU
Transducer
Pre-amp
Data
Memory
Writing digital data
Voltage
Current
Power
Power factor
Temperature
Pressure
Flow rate
Speed
Analog
signals
input
Analog signals can be input from up to four (4 channels) external instruments.
The input ranges of each channel can be selected by DIP switches as shown in
the following table.
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-335
1
9
9.2 Configuration
9.2.1 Part Names and Functions
This section describes the names and functions of parts on the KV-AD4/DA4.
KV-AD4
The following describes the names and functions of parts on the KV-AD4.
Note: A terminal for connecting external instruments is called a "channel." This is
sometimes abbreviated to "ch." Only one external instrument terminal is connected
to a single channel.
C0 C1 C2 C3
C4 C5 C6 C7
V0 V1 V2 V3
I0 I1 I2 I3
ANALOG IN
POWER
KEYENCE
KV - AD4
* Protective cover is attached
at purchase.
* Protective cover is attached
at purchase.
Voltage input terminal block 2
POWER indicator 1
Input mode selector switch 4
Current input terminal block 3
Lights red when power is being supplied.
Terminal for connecting to external instruments
that are used as the voltage input source.
No.
Terminal for connecting to external instruments
that are used as the current input source.
DIP switch for selecting the input mode
(voltage or current)
POWER indicator
Voltage input
terminal block
Input mode selector
switch
Name Function
Current input
terminal block
1
2
3
4
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-336
9
Lights red when power is being supplied.
Terminal for connecting to external instruments that are
used as the voltage output destination.
No.
Terminal for connecting to external instruments that are
used as the current output destination.
POWER indicator
Voltage output
terminal block
Name Function
Current output
terminal block
1
2
3
Note: A terminal for connecting external instruments is called a "channel." This are
sometimes abbreviated to "ch." Only one external instrument is terminal connected
to a single channel.
Do not simultaneously connect the current and voltage of the same channel
(V0 and I0,V1 and I1,V2 and I2,V3 and I3) to external instruments. Doing so
might cause the KV-DA4 to malfunction.
KV-DA4
The following describes the names and functions of parts on the KV-DA4.
CAUTION
C0 C1 C2 C3
C4 C5 C6 C7
V0 V1 V2 V3
I0 I1 I2 I3
ANALOG OUT
KEYENCE
KV - DA4
POWER
* Protective cover is attached
at purchase.
* Protective cover is attached
at purchase.
Voltage output terminal block
2
POWER indicator
1
Current output terminal block
3
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-337
1
9
9.2.2 Specifications
The tables below show general specifications, performance specifications, terminal
block specifications and the external dimensions of the KV-AD4/DA4.
KV-AD4
General specifications
Item Specifications
Model KV-AD4
Power supply voltage Supplied from CPU (24 VDC +10%, -20%)
Current consumption 120 mA max.
Ambient temperature 0 to 50C (32 to 122F), No freezing
Relative humidity 35 to 85%, No condensation
Withstand voltage 1500 VAC for 1 minute (across all external terminals and housing,
and across all power terminal and I/O terminals)
Vibration 10 to 55 Hz double-amplitude 1.5 mm max. for 2 hours each in X,
Y and Z-axes
Insulation resistance 50 M min. (across all external terminals and housing,
and across all power terminal and I/O terminals [measured by
500 VDC megohmmeter] )
Environment
Weight
No excessive dust and corrosive gases allowed
Approx. 180 g
Item Current Voltage
Analog input range -10 to +10 V 4 to 20 mA
300
No. of analog inputs 4 (4 channels)
Input impedance 1 M
Resolution 5 mV (1/4000)
Input range 10 V
4 A (1/4000)
Input range 4 to 20 mA
Conversion speed Conversion at each CPU scan
Total accuracy 0.7% Less than 1% (FS)
Isolation method Photocoupler (channels not isolated)
Max. absolute input Within 12 V 30 mA max.
Input/Output specifications
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-338
9
Analog input terminal assignment
Terminal Description
Input range: -10 to +10 V
The channel to input from is set by
the selector switch.
Ground for analog signal (connected internally)
I0
I1
I2
I3
Analog voltage input ch3
Signal
Analog voltage input ch0
Analog voltage input ch1
Analog voltage input ch2
Analog current input ch0
Analog current input ch2
Analog current input ch1
Analog current input ch3
NC (No connection)
C1
C2
C3
C4
C5
C6
C7
C0
V0
V1
V2
V3
Input range: 4 to 20 mA
The channel to input from is set by
the selector switch.
Note: Do not connect the input voltage and input current to terminals of the same
No., for example, by connecting external instruments to both V0 and I0. Doing so
might cause the KV-AD4 to malfunction.
Do not simultaneously connect the current and voltage (V0 and I0,V1 and I1,V2
and I2,V3 and I3) of the same channel to external instruments. Doing so might
cause the KV-DA4 to malfunction.
Dimensions
CAUTION
C0 C1 C2 C3
C4 C5 C6 C7
V0 V1 V2 V3
I0 I1 I2 I3
ANALOG IN
KEYENCE
KV - AD4
POWER
2-

5 (mounting hole)
99
31
65
39
43
35.4 90 111
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-339
1
9
KV-DA4
General specifications
Input/Output specifications
Item Specifications
Model KV-DA4
Power supply voltage Supplied from CPU (24 VDC, +10%, -20%)
Current consumption 200 mA max.
Ambient temperature 0 to 50C (32 to 122F), No freezing
Relative humidity 35 to 85%, No condensation
Withstand voltage 1500 VAC for 1 minute (across all external terminals and housing,
and across all power terminal and I/O terminals)
Vibration 10 to 55 Hz double-amplitude 1.5 mm max. for 2 hours each in X,
Y and Z-axes
Insulation resistance 50 M min. (across all external terminals and housing,
and across all power terminal and I/O terminals [measured by
500 VDC megohmmeter] )
Environment
Weight
No excessive dust and corrosive gases allowed
Approx. 180 g
Item Voltage Current
Analog output range -10 to +10 V
Output impedance 0.5 min.
4 to 20 mA
No. of analog outputs 4 (4 channels)
Min. load resistance
Max. load resistance
1 k
400
Resolution 5 mV (1/4000)
Output range 10 V
4 A (1/4000)
Output range 4 to 20 mA
Conversion speed Once per two scans min. (changes at startup of conversion
instruction relay)
Total accuracy 1% (FS)
Isolation method Photocoupler (channels not isolated)
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-340
9
Analog output terminal assignment
Terminal Signal Description
Output range: -10 to +10 V
NC (No connection)
Analog voltage output ch0
Analog voltage output ch1
Analog voltage output ch2
Analog voltage output ch3
Analog current output ch0
Analog current output ch2
Analog current output ch1
Analog current output ch3
I0
I1
I2
I3
C0
C1
C2
C3
C4
C5
C6
C7

V0
V1
V2
V3
Output range: 4 to +20 mA
Ground for analog signal (connected internally)
Note 1: Separate terminals are used for analog voltage input and analog current
output. Take care not to miswire these terminals.
Note 2: Do not connect the output voltage and output current to terminals of the
same No., for example, by connecting external instruments to both V0 and I0.
Doing so might cause the KV-DA4 to malfunction.
Dimensions
C0 C1 C2 C3
C4 C5 C6 C7
V0 V1 V2 V3
I0 I1 I2 I3
ANALOG OUT
KEYENCE
KV - DA4
POWER
2-

5 (mounting hole)
99
31
65
39
43
35.4 90 111
9.2 Configuration KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-341
1
9
For details on how to connect the KV-AD4/DA4 and the KV-10 to 80, see "Connecting to the KV-10
to 80 on page 1-348. For details on how to connect other I/O expansion units, refer to page 1-192.
Pay attention to the following when expanding the system.
Note 1: Only one KV-AD4 and one KV-DA4 can be connected to a single KV-10 to
80. If two or more KV-AD4/DA4s are connected, they will not operate normally.
Note 2: Always connect the KV-AD4/DA4 to the right end of the connection path.
Note 3: When both the KV-AD4 and KV-DA4 are used, make sure that one of
these units is connected to the right end of the connection path and that the other
unit is connected in between. The KV-AD4 and KV-DA4 may be connected in any
order.
9.2.3 System Configuration
This section describes the system configuration when the KV-AD4/DA4 is connected
to the KV-10 to 80.
The KV-AD4/DA4 can be connected to the KV-10 to 80 as shown in the following
diagram.
One KV-AD4 and KV-DA4 module each can be connected to a single KV-10 to 80.
Other I/O expansion units can be connected to the CPU as specified in the manual.
C0 C1 C2 C3
C4 C5 C6 C7
V0 V1 V2 V3
I0 I1 I2 I3
ANALOG IN
KEYENCE
KV - AD4
POWER
KEYENCE
KV - 10R
Power supply unit CPU
(KV-10 to 80)
KV-AD4/DA4
KV-10 to 80 I/O expansion unit KV-AD4 KV-DA4
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-342
9
9.3 Installation
9.3.1 Installation Procedure
The KV-AD4/DA4 is connected to the CPU of the KV-10 to 80 and connected to
external instruments according to the following procedure.
2
4
5
Make sure that the environment where you are going to install the KV-AD4/DA4
is appropriate.
For details, see "9.3.2 Checking the Installation Environment" on the next page.
Checking the Installation Environment
Prepare items needed for installing the KV-AD4/DA4 such as signal leads and
crimp terminals.
For details, see "Wiring" (p.1-345).
Preparation
1
3
Connect external instruments for analog input to the KV-AD4 and KV-DA4,
respectively. Before connecting the KV-AD4, the input mode (voltage and current
input terminal settings) must be set.
For details, see "9.3.3 Setting the KV-AD4 Input Mode" (p.1-344).
Connecting External Instruments
Connect the KV-AD4/DA4 to the CPU of the KV-10 to 80.
For details, see "9.3.5 Connecting to the KV-10 to 80" (p.1-348).
Connecting the KV-AD4/DA4
Trial Operation
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-343
1
9
9.3.2 Checking the Installation Environment
Do not install this system in any of the following locations.
Direct sunlight
Outside of ambient temperature 0 to 50C (32 to 122F)
Outside of relative humidity 35 to 85%
Locations likely to freeze by sudden temperature changes
Near corrosive or inflammable gases
Near excessive dust, salt spray, iron powder or smoke
Locations directly subject to vibration and shock
Locations likely to be splashed with water, oil or chemicals
Locations subject to strong magnetic or electric fields
CAUTION
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-344
9
9.3.3 Setting the KV-AD4 Input Mode
Before the KV-AD4 is connected to other units, its input mode must first be set. At
purchase, current input channels ch0 to ch3 have been set as active channels.
This operation is not necessary on the KV-DA4.
Setting the input mode
Follow the procedure below to set the input mode.
1. If the KV-AD4 is already connected to a KV series CPU, turn it OFF.
2. Set the input mode selector switches to ON if the input is voltage when the data
to be sent from connected instruments is input to a channel. If the input is cur-
rent, set the input mode selector switches to OFF.
V0/V1
I0/I1
V2/V3
I2/I3
ON
OFF
DIPSW1
DIPSW2
DIPSW1 Switch DIPSW2
ON
OFF
CH0, CH1 -10 to +10 V CH0, CH1 4 to 20 mA
CH2, CH3 -10 to +10 V CH2, CH3 4 to 20 mA
Channel Input Type Switch Setting
0ch, 1ch
2ch, 3ch
0ch, 1ch
2ch, 3ch
0ch, 1ch
2ch, 3ch
0ch, 1ch
2ch, 3ch
Current input
Voltage input
Voltage input
Current input
Voltage input
Current input
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-345
1
9
9.3.4 Connecting External Instruments
Using the analog I/O terminal block, connect external instruments for analog input
and output. For details on how to wire terminals, refer to the "Analog I/O Terminal
Wiring Diagrams."
Wiring
Follow the procedure below to wire analog I/O.
The following describes how to wire the KV-AD4.
Use 2-core twisted pair cable for the analog signal cable.
When wiring the terminals, use rounded or forked crimp terminals of width
6 mm. Wiring terminals without crimp terminals is likely to result in faulty
contact, and prevent data from being transmitted correctly. Use M3.0
screws on the terminal blocks on the KV-AD4/DA4.
Wire the AC power cable and analog signal cable separately. Do not bundle
these cables together.
With the KV-AD4, connect the shielded cable to the input side, and with the
KV-DA4, connect to the load side.
Note: When mounting the KV-AD4/DA4 at a location that is likely to be influenced
by electrical noise, ground using a grounding resistance of 100 max.
1. If the KV-AD4 is already connected
to a KV-10 to 80 CPU, turn it OFF
and then disconnect it from the
CPU.
2. Remove the protective cover of the
analog input terminal block. Hold
the left and right sides of the cover
as shown in the figure, and lift up to
remove.
3. Attach the crimp terminals of the signal cable to the terminals.
Wire the cables correctly. Wiring the cables to the incorrect terminals may
result in malfunction.
Loosen the terminal screw with a
screwdriver, and then insert the
crimp terminal.
Then, firmly tighten the terminal
screw.
For details on wiring, refer to
"KV-AD4 Analog Input Terminal"
on page 1-346 and "KV-DA4
Analog Output Terminal" on
page 1-347.
4. Attach the cover to the analog input
terminal block.
CAUTION
CAUTION
C 0 C 1 C 2 C 3
V 0 V 1 V 2 V 3
K E Y E N C E
K V - A D 4
P O W E R
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-346
9
Wiring diagrams
KV-AD4 Analog Input Terminal
Refer to the following wiring diagrams when wiring the analog input terminals.
Note: Make sure that the terminals (channels) to be wired have been set by the
input mode selection switches.
For details, see "Setting the KV-AD4 Input Mode" on page 1-344.
C3
C2
C1
C0
V3
V2
V1
V0
C
0
C
1
C
2
C
3
C
4
C
5
C
6
C
7
V
0
V
1
V
2
V
3
I0
I1
I2
I3
A
N
A
L
O
G



I
N
K
E
Y
E
N
C
E
K
V

-

A
D
4
P
O
W
E
R
Voltage output
instrument
Voltage signal
ch3
Voltage signal
ch2
Voltage signal
ch1
Voltage signal
ch0
Shielded cable
Shielded cable
Shielded cable
Shielded cable
Analog signal wire
Terminal
(Input source side)
C
0
C
1
C
2
C
3
C
4
C
5
C
6
C
7
V
0
V
1
V
2
V
3
I0
I1
I2
I3
A
N
A
L
O
G



I
N
K
E
Y
E
N
C
E
K
V

-

A
D
4
P
O
W
E
R
I3
I2
I1
I0
C7
C6
C5
C4
Shielded cable
Shielded cable
Shielded cable
Shielded cable
Analog signal
wire
Terminal
(Input source side)
Current output
instrument
Current
signal
ch3
Current
signal
ch2
Current
signal
ch1
Current
signal
ch0
Voltage input wiring
Current input wiring
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-347
1
9
Voltage output wiring
C
0
C
1
C
2
C
3
C
4
C
5
C
6
C
7
V
0
V
1
V
2
V
3
I0
I1
I2
I3
K
E
Y
E
N
C
E
K
V

-

D
A
4
P
O
W
E
R
C3
C2
C1
C0
V3
V2
V1
V0
A
N
A
L
O
G

O
U
T
(Load side)
+

Shielded cable
Shielded cable
Shielded cable
Shielded cable
Analog signal wire
Terminal
Voltage signal
ch3
Voltage
input instrument
Voltage signal
ch2
Voltage signal
ch1
Voltage signal
ch0
Current output wiring
C
0
C
1
C
2
C
3
C
4
C
5
C
6
C
7
V
0
V
1
V
2
V
3
I0
I1
I2
I3
A
N
A
L
O
G

O
U
T
K
E
Y
E
N
C
E
K
V

-

D
A
4
P
O
W
E
R
I3
I2
I1
I0
C7
C6
C5
C4
Shielded cable
Shielded cable
Shielded cable
Analog signal wire
Terminal
(Load side)
+

Current
signal
ch3
Current input
instrument
Current
signal
ch2
Current
signal
ch1
Current
signal
ch0
KV-DA4 Analog Output Terminal
Refer to the following wiring diagrams when wiring the analog output terminals.
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-348
9
Note: Make sure that the power is turned OFF before connecting the KV-AD4/DA4
to the KV-10 to 80.
1. Slide up the protective cover on the
right of KV-10 to 80.
2. Connect the connector cable from
the KV-AD4/DA4 to the connector
on the KV-10 to 80.
Protective cover
9.3.5 Connecting to the KV-10 to 80
Connect the KV-AD4/DA4 to the KV-10 to 80 CPU.
The following example describes how to connect a KV-AD4 to the right side of a KV-
10.
KV-10
KV-AD4
Connector cable
CAUTION
Note: Connector cables cannot be extended.
For details on how to connect the I/O expansion unit and the KV-AD4/DA4, see "9.2.3 System
Configuration" page 1-341.
When connecting the connector cable do not hold it by its cable. Hold it by
the connector. Applying unnecessary force on the cable may cause the unit
to malfunction.
Always connect the connector cable by hand. Using a tool to connect the
connector cable may apply excessive force on the unit, causing it to mal-
function.
9.3 Installation KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-349
1
9
9.3.6 Maintenance
This section describes how to inspect and clean the unit.
Inspection and Cleaning
I Inspection
Connectors become loose when a KV Series unit is used for a long time. If you
continue to use a KV Series unit with loose connectors, this may cause the unit
to malfunction.
For this reason, you must periodically inspect the unit and connectors.
Generally, inspect the following points:
Are connection parts disconnected or loose?
Are connectors disconnected or loose?
Are the terminal screws on the terminal block loose?
Are relays fused or their contacts faulty?
Are connector cables between units and instruments damaged?
I Cleaning
Dirt adheres to the CPU and other units when they are used continuously for a
long time. Clean off any dirt on these units with a clean cloth.
Before removing any dust or dirt from fine parts such as connectors, remove the
connector and then remove with a cotton swab.
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-350
9
9.4 Programming
9.4.1 Programming the KV-AD4
This section describes the A/D conversion mechanism, and the digital data that is
written to the CPU by the KV-AD4 after A/D conversion. It also describes how to
calculate actual voltage and current values based upon the digital data written to
CPU.
A/D Conversion Mechanism
This item describes the A/D conversion mechanism on the KV-AD4. Check this item
before writing sequence programs for the KV-AD4.
1. The analog signal (voltage or current) is input to the KV-AD4 from the external
instrument.
This operation is called "analog input."
2. The KV-AD4 converts the analog signal to digital data.
This operation is called "A/D conversion."
3. The KV-AD4 then writes the digital data to the data memory for A/D conversion
on the CPU.
Digital data is automatically written at each scan.
For details, see "About Digital Data after A/D Conversion" on the next page.
4. If necessary, the digital data is processed by the sequence program on the CPU.
The value of the actual input voltage or current can be calculated from the
digital data.
For details, see "Calculating Voltage and Current Values from Digital Data"on page 1-352.
The calculated values can be used for further processing besides the sequence program.
The digital data can also be output as analog data as it is.
Power
supply
unit
A/D
converter
KV-AD4 CPU
Writing digital data
Sequence
program
Data memory for
A/D conversion
Analog
input
Transducer
or
pre-amp
External
instrument
(e.g. sensor)
1
2
3
4
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-351
1
9
About Digital Data after A/D Conversion
Data Memory to which digital data is written
The KV-AD4 converts analog signals that have been input from external instruments
to digital data, and writes this digital data to data memory for A/D conversion on the
CPU.
Data memory for A/D conversion on the CPU is used only when the KV-AD4 is
connected to the CPU. This memory can be used as regular data memory when the
KV-AD4 is not connected to the CPU. When the KV-AD4 is connected to the CPU,
this memory can be used only for A/D conversion and not for other applications.
Note: When the KV-AD4 is connected to the CPU, the conversion data is written at
each scan even if the channels on the KV-AD4 are not in use.
The address of the data memory to which digital data is written varies according to
the channel (terminal) to which the instrument for analog input is connected. The
following table shows the correspondence between channel and data memory.
Channel Data Memory
CH0
CH1
CH2
CH3
DM0992
DM0993
DM0994
DM0995
Digital data content
The numerical values of the digital data that is written to data memory for A/D
conversion are not obtained by simply converting actual voltage or current to binary
format. During conversion they are influenced by the input characteristics preset by
the user. The KV-AD4 voltage and input characteristics are as follows.
For example, when analog input is +5 V, 3000 will be written to the data memory
for A/D conversion. If the analog input is outside of the input range, 0 and 4095 are
written as the minimum and maximum values.
Digital data
+4000
+3000
+2000
+1000
-10 +10 -8 -6 -4 -2
0
+2 +4 +6 +8
Voltage
(V)
Range: 10 V
Voltage input characteristics
Digital data
+4000
+3000
+2000
+1000
0
2 4 6 8 1012141618 20
Range: 4 to 20 mA
Current
(mA)
Current input characteristics
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-352
9
Calculating Voltage and Current Values from Digital Data
This item describes how to calculate the actual input voltage or current values
(decimal) from the digital data written to data memory for A/D conversion as a result
of A/D conversion. Executing this calculation in the sequence program allows the
calculated voltage or current values to be used in other processes in the program.
The voltage and digital data conversion tables are shown in "9.4.3 A/D and D/A Conversion Tables"
on page 1-357. Sample programs are provided under "9.5 Programming Examples" on page 1-359.
How to calculate analog input voltage
Analog input voltage (mV) =
(digital data x resolution (5 mV)) - offset value (10000)
Example
When digital data value 3800 (decimal) is written to data memory
(3800 x 5 (mV)) - 10000 = 9000 (mV) = 9 (V)
This indicates that an analog value of 9 V was input to the KV-AD4.
How to calculate analog input current
Analog input current (mA) =
(digital data x resolution (4 A)) + offset value (4000)
Example
When digital data value 3800 (decimal) is written to data memory
(3800 x 4 (A)) + 4000 = 19200 (A) = 19.2 (mA)
This indicates that an analog value of 19.2 mA was input to the KV-AD4.
Resolution
"Resolution" refers to the minimum analog input value by which digital data can be
changed. For example, 5 mV is the resolution of input range -10 to +10 V. This
indicates that the digital data in memory changes when the analog input value
changes by at least 5 mV. The digital data in memory will not change if the analog
input value changes by only 4 mV.
Why is the resolution 5 mV, 4 A?
Only the upper 12 bits of digital data are written to data memory. The maximum
value that can be expressed in 12 bits is expressed as 4095 in decimal (approxi-
mated to 4000). Accordingly, 1/4000 of the input range full scale (FS) is taken as the
resolution on the KV-AD4/DA4. For example, the resolution of input range -10 to +10
V can be calculated as follows:
20000 (mV) 4000 = 5 (mV)

Full scale of input range -10 to +10 V is 20 V (20000 mV).


9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-353
1
9
9.4.2 Programming the KV-DA4
This section describes the D/A conversion mechanism, how to convert the voltage
and current values to digital data for analog output, and how to output this digital
data as analog data from the KV-DA4.
D/A Conversion Mechanism
This item describes the D/A conversion mechanism on the KV-DA4. Check this
item before writing sequence programs for the KV-DA4.
External
instrument
Power
supply
unit
KV-DA4 CPU
Writing digital data
Sequence
program
Data memory for
D/A conversion
4
5
3
2
1
D/A
conversion
Analog
output
1. The voltage or current value to be output to external instruments is converted to
digital data by the sequence program on the CPU.
For details, see "Converting Digital Data to Voltage or Current Values to be Output" on page 1-
354.
2. The digital data on the channel to be converted is written to the data memory for
D/A conversion by the sequence program.
For details, see "Converting Digital Data to Voltage or Current Values to be Output" on page 1-
354.
3. The special utility relay for D/A conversion of the channel to be converted to
analog data is set to ON.
The special utility relay for D/A conversion acknowledges the request at the
rising edge of the relay.
For details, see "Writing Digital Data to Data Memory for D/A Conversion" on page 1-356.
The D/A conversion instruction is transferred to the KV-DA4.
4. KV-DA4 converts the digital data to analog voltage or current signals.
This operation is called "D/A conversion."
5. The analog signals are output to the external instrument from the KV-DA4.
This operation is called "analog output."
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-354
9
Converting Digital Data to Voltage or Current Values to be Output
To output digital data as analog data, the voltage and current values that are to be
output from the KV-DA4 are first converted to the corresponding digital data by the
sequence program, and written to the data memory for D/A conversion. Voltage and
current values cannot be written to the data memory for D/A conversion as they are.
For details on the voltage/digital data conversion tables, see "9.4.3 A/D and D/A Conversion Tables"
on page 1-357. For details on sample programs, see "9.5 Programming Examples" on page 1-359.
For details on data memory for D/A conversion, see "9.4.3 A/D and D/A Conversion Tables" on page
1-357.
Note: When making a sequence program, take care not to exceed the output range
(0 to 4095). If a value exceeding this range is written to the data memory for D/A
conversion, unsteady values will be output from the KV-DA4.
How to calculate digital data when outputting analog voltage
Digital data = (output voltage (mV) resolution (5 mV)) + offset value (2000)
Example
When outputting +7.5 V
(7500 (mV) 5 (mV)) + 2000 = 3500
Write "3500" to D/A conversion memory.
Next, turn ON the special utility relay for D/A conversion.
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-355
1
9
How to calculate digital data when outputting analog current
Digital data = (output current (A) resolution (4 A)) - offset value (1000)
Example
When outputting 18 mA
(18000 (A) 4 (A)) - 1000 = 3500
Write "3500" to data memory for D/A conversion.
Next, turn ON the special utility relay for D/A conversion.
Resolution
"Resolution" refers to the minimum analog output value by which digital data can be
changed. For example, 5 mV is the resolution of output range -10 to +10 V. This
indicates that the analog output changes by 5 mV when the value of the digital data
changes by 1.
Digital data content
The KV-DA4 voltage and current output characteristics are as follows.
For example, the digital data for outputting +5 V is 3000.
Digital
data
+
1
0
0
0
+
2
0
0
0
+
3
0
0
0
+
4
0
0
0
+10
-8
-6
-4
-2
0
+2
+4
+6
+8
Range: 10 V
-10
Voltage
(V)
Voltage output characteristics
Digital
data
+
1
0
0
0
+
2
0
0
0
+
3
0
0
0
+
4
0
0
0
0
2
6
8
10
12
14
16
18
Current
(mA)
20
4
Range: 4 to 20 mA
Current output characteristics
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-356
9
Writing Digital Data to Data Memory for D/A Conversion
This section describes how to write digital data after it has been converted from the
voltage or current to be output to data memory for D/A conversion on the CPU.
Data memory for D/A conversion on the CPU and special utility relays for D/A
conversion are used only when the KV-DA4 is connected to the CPU. This data
memory and special utility relays can be used as regular data memory and relays,
respectively, when the KV-DA4 is not connected to the CPU. When the KV-DA4 is
connected to the CPU, this data memory and special utility relays can be used only
for D/A conversion and not for other applications. If data memory for D/A conversion
and special utility relays for D/A conversion are used for other applications, this may
cause the KV-DA4 to malfunction .
The following table shows the correspondence between channels, data memory and
special utility relays for D/A conversion.
To output digital data as analog data, the digital data to be analog-output is first
written to data memory for D/A conversion, and then the special utility relays for D/A
conversion is turned ON matching the channel from which digital data is to be
output.
Note 1: The CPU transfers the data on the rising edge of the special utility relays for
D/A conversion. So, analog output will not change while the special utility relays for
D/A conversion stays ON.
Note 2: KV-DA4 outputs voltage 0V and current 4 mA when the power is turned ON.
Note 3: In the case of voltage output, set 0 V (digital data value 2000) and set the
special utility relays for D/A conversion to ON for each channel in use before the
data in data memory for D/A conversion is changed.
-10 to 0 V (less than digital data value 2000) will be output only when 0V (2000) is
set. Otherwise, -10 to 0 V will not be output.
Note 4: Leave unused terminals open at all times. KV-DA4 has voltage and current
output modes, and outputs preset data from both terminals at all times.
Note 5: The voltage and current of the same channel No. cannot be used simulta-
neously.
Data Memory for
D/A Conversion
Channel
Special Utility Relay for
D/A Conversion
CH0
CH1
CH2
CH3
DM0996 2800
DM0997
DM0998
DM0999
2801
2802
2803
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-357
1
9
9.4.3 A/D and D/A Conversion Tables
Refer to the following tables when creating programs that involve A/D or D/A
conversion.
Voltage Conversion Table
Voltage range: +10 to -10 V
+10
+9
.00
4000
3800
4020
3820
.10
4040
3840
.20
Voltage integer
Numerical value of voltage down to two digits past the decimal point
Digital data corresponding to voltage
+10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+0
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
.00
4000
3800
3600
3400
3200
3000
2800
2600
2400
2200
2000
2000
1800
1600
1400
1200
1000
800
600
400
200
0
.10
4020
3820
3620
3420
3220
3020
2820
2620
2420
2220
2020
1980
1780
1580
1380
1180
980
780
580
380
180
.20
4040
3840
3640
3440
3240
3040
2840
2640
2440
2240
2040
1960
1760
1560
1360
1160
960
760
560
360
160
.30
4060
3860
3660
3460
3260
3060
2860
2660
2460
2260
2060
1740
1540
1340
1140
940
740
540
340
140
.40
4080
3880
3680
3480
3280
3080
2880
2680
2480
2280
2080
1720
1520
1320
1120
920
720
520
320
120
.50
3900
3700
3500
3300
3100
2900
2700
2500
2300
2100
1700
1500
1300
1100
900
700
500
300
100
.60
3920
3720
3520
3320
3120
2920
2720
2520
2320
2120
1680
1480
1280
1080
880
680
480
280
80
.70
3940
3740
3540
3340
3140
2940
2740
2540
2340
2140
1660
1460
1260
1060
860
660
460
260
60
.80
3960
3760
3560
3360
3160
2960
2760
2560
2360
2160
1640
1440
1240
1040
840
640
440
240
40
.90
3980
3780
3580
3380
3180
2980
2780
2580
2380
2180
1940 1920 1900 1880 1860 1840 1820
1620
1420
1220
1020
820
620
420
220
20
Example
The digital data is 3820 (shaded section in the following table) when the voltage
is 9.1 V.
9.4 Programming KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-358
9
Current Conversion Table
Current range: 4 to 20 mA
Example
The digital data is 3775 (shaded section in the following table) when the current
is 19.10 mA.
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
.00
4000
3750
3500
3250
3000
2750
2500
2250
2000
1750
1500
1250
1000
750
500
250
0
.10
4020
3775
3525
3275
3025
2775
2525
2275
2025
1775
1525
1275
1025
775
525
275
25
.20
4040
3800
3550
3300
3050
2800
2550
2300
2050
1800
1550
1300
1050
800
550
300
50
.30
4060
3825
3575
3325
3075
2825
2575
2325
2075
1825
1575
1325
1075
825
575
325
75
.40
4080
3850
3600
3350
3100
2850
2600
2350
2100
1850
1600
1350
1100
850
600
350
100
.50
3875
3625
3375
3125
2875
2625
2375
2125
1875
1625
1375
1125
875
625
375
125
.60
3900
3650
3400
3150
2900
2650
2400
2150
1900
1650
1400
1150
900
650
400
150
.70
3925
3675
3425
3175
2925
2675
2425
2175
1925
1675
1425
1175
925
675
425
175
.80
3950
3700
3450
3200
2950
2700
2450
2200
1950
1700
1450
1200
950
700
450
200
.90
3975
3725
3475
3225
2975
2725
2475
2225
1975
1725
1475
1225
975
725
475
225
20
19
.00
4000
3750
4020
3775
.10
4040
3800
.20
Current integer
Numerical value of current down to two digits past the decimal point
Digital data corresponding to current
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-359
1
9
9.5 Programming Examples
This section describes sample programs for the KV-AD4/DA4. Refer to this section
when making programs for the KV-AD4/DA4.
Calculating Analog Data Values from Digital Data
This sample program reads A/D-converted digital data from memory, and calculates
the value of the actual analog-input voltage.
Conditions
The analog input data from analog input V0 on the KV-AD4 is calculated.
(The digital data of data memory DM0992 is used for this operation.)
When the calculated value is a positive value, an absolute value is written to
memory DM0100, and when the calculated value is a negative value, an absolute
value is written to memory DM0101. Data is written in mV units.
For example:
When the input is +10 V, "10000" (data x 1000) will be written to DM0100.
When the input is - 10 V, "10000" (data x 1000) will be written to DM0101.
Ladder diagram
1. The data of DM0992 is calculated, and the calculation result (data x 5 mV -
10000) is written to DM0000.
2. The KV-AD4 judges that the DM0000 data is positive or negative by comparing
DM0000 with $8000. (When the MSB of DM0000 is OFF, the data is judged to
be positive, and when it is ON, the data is judged to be negative.)
3. If the data is a positive value, the calculation result is written to DM0100.
4. If the data is a negative value, the 2s complement of the data is calculated to
change its sign to a positive sign, and the result is written to DM0101.
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.
DM0000

LDA
2007
2009
2009
DM0000

LDA
DM0992
LDA
$8000

CMP
#00005

MUL
DM0000

STA
DM0000

LDA

COM
DM0100

STA
DM0101

STA
#00001
ADD
#10000

SUB
1
2
3
4
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-360
9
Example 1: Inputting Analog Voltage (-10 to +10 V)
The analog input data from analog input V0 on the KV-AD4 is calculated.
(The digital data of data memory DM0992 is used for this operation)
The calculated data is written to DM0000. (If the calculated value is a negative
value, 2s complement is written.) Data is written in mV units.
For example:
When the input is +10V, "10000" (data x 1000) will be written to DM0000.
When the input is -10V, "-10000 (#55536)" (data x 1000) will be written to
DM0000.
1. The data of DM0992 will be calculated, and the calculation result (data x 5 mV -
10000) will be 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.
Example 2: Inputting Analog Current (4 to 20 mA)
The analog input data from analog input I0 on the KV-AD4 is calculated.
(The digital data of data memory DM0992 is used for this operation.)
The calculated data is written to DM0000. Data is written in A units.
For example:
When the input is 4 mA, "4000" (data x 1000) will be written to DM0000.
When the input is 20 mA, "20000" (data x 1000) will be written to DM0000.
2007 DM0992

LDA
#00005
MUL
DM0000

STA
#10000
SUB
1
1. The data of DM0992 will be calculated, and the calculation result (data x 4 A +
4000) will be 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.
2007 DM0992
LDA
#00004
MUL
DM0000
STA
#04000
ADD 1
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
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
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
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
( )
( )
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-363
1
9
Example 2: Outputting Analog Current (4 to 20 mA)
Data that has been written to DM0000 is converted to digital data for analog
output.
The digital data is sent to analog output I0 on the KV-DA4.
(Digital data is written to data memory DM0996.)
4 mA is output when input 0000 is ON.
20 mA is output when input 0000 is OFF.
1. #4000 is written to DM0000 when input 0000 is ON.
2. #20000 is written to DM0000 when input 0000 is OFF.
3. ((DM0000 4 A) - 1000) is calculated, and the calculation result is written to
DM0001.
4. 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.
5. 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.)
Note: In the case of current output, DM0996 need not be initialized (#2000 written to
DM0996) when the power is turned ON.
0000 #04000

DW
0000
DM0000

#20000
DM0000
DW
2002 DM0000

LDA
#00004
DIV
DM0001

STA
#01000
SUB
1000
1000
1000
2800

2002 2011 DM0001
LDA
#04095
CMP
DM0001
LDA
DM0996
STA
1
2
3
4
5
( )
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-364
9
1. DM0996 is initialized when the power is turned ON.
(That is, #2000 is written to DM0996.)
2. ((trimmer 0 x 2000) 249) is calculated, and 0 to 2000 is written to DM0000.
3. (DM0000 + 2000) is calculated when input 0000 is ON, and the calculation result
is written to DM0001.
4. (2000 - DM0000) is calculated when input 0000 is OFF, and the calculation 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.)
Outputting Analog Trimmer Values
This sample program outputs the value of analog trimmer 0 on the CPU.
Conditions
The value of trimmer 0 is converted to data for analog output.
The data is sent to analog output V0 on the KV-DA4.
(Digital data is written to data memory DM0996.)
When input 0000 is ON, 0 to +10 V is output. To increase the voltage, turn the
trimmer clockwise.
When input 0000 is OFF, -10 to 0 V is output. To decrease the voltage, turn the
trimmer counterclockwise.
Ladder diagram
2002

DM0001
LDA

#04095
CMP
DM0001
STA
#02000
LDA
DM0000
SUB

DM0001
STA

DM0996
DIV
1000
1500
1000

1000
2800
2008 #02000
LDA
DM0996
STA
1500
0000
DM0000
LDA
#02000
ADD

DM0001
STA
2011
2007 0
TMIN
#02000
MUL
DM0000
STA
#00249
DIV
0000
1
2
3
4
5
6
( )
( )
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-365
1
9
Outputting Analog Input Data
This sample program outputs data received from the analog inputs.
Note: Voltage can be converted to current, and vice versa by switching the I/O
wiring.
Conditions
Analog data is input from analog input V0 on the KV-AD4.
(The digital data of data memory DM0992 is used for this operation.)
The data that was input from analog input V0 is output as it is to analog output
V0 on the KV-DA4. (The digital data is written to data memory DM0996.)
Ladder diagram
1. DM0996 is initialized when the power is turned ON.
(That is, #2000 is written to DM0996.)
2. Digital data in data memory for A/D conversion is written to DM0001.
3. 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.
4. 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.)
2008 #02000

LDA
2007

DM0992
LDA
1000
DM0996

STA
DM0001

STA
1500
1000
1000
2800
1500

2002 2011 DM0001
LDA
#04095
CMP
DM0001
LDA
DM0996
STA
1
2
3
4
( )
( )
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-366
9
Outputting Analog Input from a Pressure Sensor to an Air Valve
This sample program outputs analog inputs (1 to 5 V) from a pressure sensor to an
air valve (4 to 20 mA).
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 data that was input from analog input V0 is converted, and output to analog
output I0 on the KV-DA4. (The digital data is written to data memory DM0996.)
When the input data in DM0992 is a low value, the output current is decreased.
When input data in DM0992 is a high value, the output current is increased.
Input data 1 V (#2200) in DM0992 is converted to output data 20 mA (#4000) in
DM0996.
Input data 5 V (#3000) in DM0992 is converted to output data 4 mA (#0000) in
DM0996.
Ladder diagram
1. The data of DM0992 is calculated, and the calculation result ((DM0992 - 2200) x
5 mV) is written to DM0000.
2. (4095 - DM0000) is calculated, and the calculation result is written to DM0001.
3. 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.
4. 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.)
Note 1: "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.
Note 2: In the case of current output, DM0996 need not be initialized (#2000 written
to DM0996) when the power is turned ON.
2007 DM0992

LDA
#02200
SUB
2002 #04000
LDA
1000
DM0000

SUB
DM0000

STA
DM0001

STA
#00005
MUL
1000
1000
2800

2002 2011 DM0001
LDA
#04095
CMP
DM0001
LDA
DM0996
STA
1
2
3
4
( )
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
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
( )
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-368
9
2008 #03000
DM0001
DW
#01000
DM0002
DW
#00000
DM0004
DW
#00000
DM0005
DW
#00000
DM0006
DW
#00000
DM0007
DW
#00000
DM0008
DW
#00000
DM0009
DW
#01000
DM0003
DW
#00000
DM0010
DW
0502
2007 DM0992
LDA
DM0004
STA
DM0008
INC
2002 2009 DM0010
LDA
DM0004
ADD
DM0010
STA
2009 DM0010
STA
2010
DM0009
INC
DM0003
DIV
1100 DM0007
LDA
#00000
CMP
DM0007
LDA
DM0005
STA
DM0006
STA
1100
(SET)
DM0007
STA
#00020
T000
2011 2002 DM0007
LDA
DM0001
CMP
0500
0501
1000
2010 2002 DM0008
LDA
DM0003
CMP
2011 1100 DM0007
LDA
DM0005
CMP
DM0007
LDA
DM0005
STA
2009 1100 DM0007
LDA
DM0006
CMP
DM0007
LDA
DM0006
STA
#00000
DM0008
DW
#00000
DM0009
DW
#00000
DM0010
DW
DM0009
LDA
TM00
STA
DM0010
LDA
0500
1000
2009 DM0002
CMP
T000
#00020
T001
1001
1001
0501 T001
1
2
3
4
5
6
( )
( )
( )
( )
( )
7
8
Ladder diagram
Data Memory Assignment
DM0001
DM0002
DM0003
DM0004
DM0005
DM0006
DM0007
DM0008
DM0009
DM0010
Maximum limit setting
Minimum limit setting
Average count
Measurement value
Maximum average value
Minimum average value
Average value
Measurement count
Upper bit of accumulated value
Lower bit of accumulated value
Relay Assignment
500
501
502
Maximum limit error
Minimum limit error
Average value measurement completed
9.5 Programming Examples KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-369
1
9
1. The initial settings are made.
2. The value of input data (DM0992) is written to measurement value (DM0004),
and measurement count (DM0008) is incremented by one.
3. Measurement values are accumulated (DM0004), and written to accumulated
values (DM0009 and DM0010). When the lower bit of the accumulated value
(DM0010) overflows (2009 turns ON), "1" is added to the upper bit of accumu-
lated value (DM0009).
4. When measurement count (DM0008), and accumulated values (DM0009 and
DM0010) are divided by average count (DM0003) to calculate average value
(DM0007). By this operation, relay 502 is turned ON to indicate completion of the
average value measurement, and measurement count (DM0008), and accumu-
lated values (DM0009 and DM0010) are reset.
5. When average value (DM0007) exceeds maximum limit setting (DM0001),
internal relay 1000 switches ON, and relay 500 switches on for two seconds to
indicate the maximum limit error.
When average value (DM0007) falls below minimum limit setting (DM0002),
internal relay 1001 switches ON, and relay 501 switches on for two seconds to
indicate the minimum limit error.
6. If average value (DM0007) becomes a value other than the initial setting (#0000),
maximum average value (DM0005) and minimum average value (DM0006) are
overwritten with the average value.
7. Average value (DM0007) is compared with maximum average value (DM0005),
and the maximum average value is overwritten if the average value is greater.
8. Average value (DM0007) is compared with minimum average value (DM0006),
and the minimum average value is overwritten if the average value is smaller.
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.
9.6 Troubleshooting KV-10/80 Series Only
K
V
-
3
0
0
K
V
-
1
0
/
8
0
Chapter 9 KV-AD4/DA4 Analog I/O Unit
1-370
9
9.6 Troubleshooting
This appendix describes how to remedy problems that may occur on the KV-AD4/
DA4.
YES
YES
Analog I/O impossible
NO
NO
YES
YES
YES
NO
NO
NO
NO
POWER
indicator lit?
Check connection on
analog I/O terminal block.
Check DIP switch setting.
Analog I/O
possible?
Check sequence program.
Check KV
program
referring
to sample
program.
Check analog
output sequence
program.
Analog I/O
possible?
Analog input
possible?
Analog input
possible?
Contact your nearest
KEYENCE office.
* Analog values may fluctuate slightly after the power is turned ON.
END
CPU POWER
indicator lit?
Check connection
between units.
Make sure that
24 V is supplied
to CPU.
YES
YES
YES
YES
NO
NO
NO
NO
YES
Data memory
DM0992 to DM0995
used for other
purpose?
Only one KV-AD4 or
KV-DA4 each can be
connected to CPU.
Check number of units.
Data memory
DM0996 to DM0999
used for other
purpose?
Data memory
initialized (#2000 written to
DM0996 to DM0999)
Data updated
at rising edge of special
utility relay (2800 to
2803)?

Вам также может понравиться