Mitsubishi QD51 Programming Manual page 315

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
MKD$
Function
• Converts a double-precision type numeric value into a character string.
MKD$ ( <double precision expression> [, S] )
Syntax
double precision expression
C$=MKD$(3. 14159265389)
Examples
• The MKD$ function converts a double-precision numeric value to an 8-byte character
Description
string.
• Double-precision 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 MKD$ function.
• The data converted into a character string by the MKD$ function can be restored to the
original numeric value only by the CVD function.
• It is recommended to use the LSET instruction when writing data that was converted to a
character string using the MKD$ 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 MKD$ function, the data will not
be correctly converted by the CVD function.
Example
11 - 145
MaKe Double $
• • • •
• • • •
LSET B$=A$
B$ P U U U U U U
LET C$=B$
C$= "PUUUUUU
"
B#=CVD(C$)
B#=3.333333333333333
(Correct)
Specify the double precision expression to be
converted into a character string.
Converts into an 8-byte character string and stores in
C$.
OPEN "
:
" AS #1
FIELD #1, 10 AS B$
A#=3.333333333333333
A$=MKD$(A#)
Write
Write
File
Read
Read
MELSEC-Q
RSET B$=A$
B$
P U U U U U U
LET C$=B$
C$= "
PUUUUUU
B#=CVD(C$)
B#=9.473903143414155D-14
(Incorrect)
11 - 145
"

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents