11 - 145 11 - 145
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
MKD$
Function
MaKe Double $
• Converts a double-precision type numeric value into a character string.
MKD$ ( <double precision expression> [, S] )
Syntax
double precision expression
• • • •
Specify the double precision expression to be
converted into a character string.
Examples
C$=MKD$(3. 14159265389)
• • • •
Converts into an 8-byte character string and stores in
C$.
Description
• The MKD$ function converts a double-precision numeric value to an 8-byte character
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
OPEN " : " AS #1
FIELD #1, 10 AS B$
A#=3.333333333333333
A$=MKD$(A#)
B$ P U U U U U U
B#=3.333333333333333
B#=CVD(C$)
C$= "PUUUUUU "
LSET B$=A$
LET C$=B$
(Correct)
C$= " PUUUUUU "
B#=9.473903143414155D-14
B#=CVD(C$)
LET C$=B$
RSET B$=A$
B$
P U U U U U U
Write
Write
Read
Read
File
(Incorrect)
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...