11 - 148 11 - 148
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
MKI$
Function
MaKe Integer $
• Converts an integer type numeric value into a character string.
MKI$ ( <integer expression> [, S] )
Syntax
integer expression
• • • •
Specify the integer to be converted into a character
string.
Examples
A$=MKI$(314)
• • • •
Converts into a 2-byte character string and stores in
A$.
Description
• The MKI$ function converts an integer type numeric value to a 2-byte character string.
• Integer type numeric values that will be written to the random file buffer using the LSET or
RSET instruction must be converted to a character string with the MKI$ function.
• The data converted into a character string by the MKI$ function can be restored to the
original numeric value only by the CVI function.
• It is recommended to use the LSET instruction when writing data that was converted to a
character string using the MKI$ function to the random file buffer.
If the field length (number of bytes) of each variable specified by the FIELD instruction is
greater than the used field length (number of bytes) of the MKI$ function, the data will not
be correctly converted by the CVI function.
Example
OPEN " : " AS #1
FIELD #1, 10 AS B$
A%=100
A$=MKI$(A%)
B$ d
B%=100
B%=CVI(C$)
C$= "d "
LSET B$=A$
LSET C$=B$
(Correct)
C$= " d "
B%=8224
B%=CVI(C$)
LET C$=B$
RSET B$=A$
B$
d
Write
Write
Read
Read
File
(Incorrect)
The CVI function converts the required number of bytes from the left side of each variable
area specified by the FIELD instruction.
• The data converted to character strings using the MKI$ function may be used for data
communication as well as for writing to the random file buffer.
• When the [,S] option is specified, the integer will be converted to a character string and
rearranged as follows.
1)
2)
2)
1)
Converts into
character string.
%
L
H
REMARK
See the MKD$, MKS$, CVD, CVI, and CVS functions.