beautypg.com

Ascii code/binary conversion function, Kv -300 – KEYENCE Visual KV Series User Manual

Page 290

background image

7.5 KV Mode Programming

KV-300 Series Only

KV

-300

KV-10/80

Chapter 7 KV-L2 Serial Interface Module

1-266

7

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.

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.

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.

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.

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.

KVHKA Chap 07_5to10.p65

08.3.11, 11:18 AM

266