Kv -300 – KEYENCE Visual KV Series User Manual
Page 291

7.5 KV Mode Programming
KV-300 Series Only
KV
-300
KV-10/80
Chapter 7 KV-L2 Serial Interface Module
1-267
1
7
■ 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.
■ 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.
■ 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.
■ 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.
■ 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.
KVHKA Chap 07_5to10.p65
08.3.11, 11:18 AM
267