3 sample program – KEYENCE Visual KV Series User Manual
Page 344

7.3 Loading Text Data
3-320
7
Chapter 7 Serial Communication
T000
T001
2803
0500
2801
2800
0000
2008
1001
2800
0500
DM1007
LDA
DM1006
LDA
DM1005
LDA
DM1004
LDA
DM1003
LDA
DM1002
LDA
DM1001
LDA
DM1000
LDA
1001
DIFU
#00010
T000
#00030
T001
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
2804
SET
END
ENDH
#00009
DW
DM1100
$0002
DW
DM1101
$004B
DW
DM1102
$0045
DW
DM1103
$0059
DW
DM1104
$004E
DW
DM1106
$0043
DW
DM1107
$0045
DW
DM1108
$0003
DW
DM1109
$0045
DW
DM1105
STX
K
E
Y
E
N
C
E
ETX
Turns ON output relay 0500
for 3 seconds when
reception error occurs.
Sends break signal (1 sec.).
One scan ON
Break signal
Transmits text data ("STX KEYENCE ETX").
Transmission
start relay
No. of
transmitted
data
Trans-
mission
relay
Receives text data.
Reception relay
No. of
received data.
Received
data
Reception error
When power is turned ON,
transmits a break signal for
one second during the first
scan.
Transmits text data when
input relay 0000 turns ON.
Receives text data.
Received
data
Received
data
Received
data
Received
data
Received
data
Received data
Special utility relay operation
Two special utility relays are assigned for each channel for data transmission. Text
data or a break signal is transmitted when the respective relay is turned ON/OFF.
Note 1: Be sure to transmit a break signal for the first serial communication with a
personal computer after the KV-P3E(01) handheld programmer is connected to the
KV, or after the "KV IncrediWare (DOS)" or "LADDER BUILDER for KV" program-
ming support software is evoked.
A break signal initializes the communication setting for the KV. If you cannot transmit
a break signal, turn the KV OFF once to initialize the communication setting.
The KV will not transmit/receive text data unless its communication setting has been
initialized.
Note 2: Turn ON special utility relay 2804 (2809) (SET 2804 [2809])
*1
to transmit text
data. Special utility relay 2804 (2809)
*1
remains ON during text data transmission,
and automatically turns OFF when the transmission completes.
To forcefully stop the text data transmission, turn OFF special utility relay 2804
(2809) (RES 2804 [2809])
*1
.
Note 3: A break signal is transmitted while special utility relay 2808
*2
is turned ON.
Use the SET-RES instruction pair or OUT-OUB instruction pair to control a break
signal. The communication program of the destination KV is initialized after a break
signal has been transmitted.
*1: 2807 with KV-300/10/80 *2: 2803 with KV-300/10/80
7.3.3
Sample Program
The following is the sample program to transmit/receive text data using communica-
tion port A on the KV basic unit.
Data to be transmitted: KEYENCE
Transmission header: STX
Transmission delimiter: ETX
Length of received data: Fixed to 7 bytes
.
o
N
y
a
l
e
R
)
A
t
r
o
P
(
.
o
N
y
a
l
e
R
)
B
t
r
o
P
(
.
o
N
y
a
l
e
R
)
0
8
/
0
1
/
0
0
3
-
V
K
(
n
o
i
t
p
i
r
c
s
e
D
4
0
8
2
9
0
8
2
7
0
8
2
.
a
t
a
d
t
x
e
t
g
n
i
t
t
i
m
s
n
a
r
t
s
p
o
t
s
/
s
t
r
a
t
S
p
o
t
S
:
F
F
O
,
t
r
a
t
S
:
N
O
0
0
8
2
5
0
8
2
3
0
8
2
.
l
a
n
g
i
s
k
a
e
r
b
g
n
i
t
t
i
m
s
n
a
r
t
s
p
o
t
s
/
s
t
r
a
t
S
p
o
t
S
:
F
F
O
,
t
r
a
t
S
:
N
O
KVNKA Chap 07.p65
08.3.11, 0:11 PM
320