Mitsubishi QD51 Programming Manual page 554

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
STR$
Function
• Converts a value to a character string, assuming the value is given as a decimal number.
STR$(<numeric expression>)
Syntax
numeric expression
A$=STR$(-1.602)
Examples
B$=STR$(3.12E08)
• The STR$ function returns the value in <numeric expression> as a character string
Description
expression of a decimal number. Note that it is not allowed to specify data other than
numeric values and variables. All types of numeric values are valid for specification as the
value of <numeric expression>, such as real numbers (double-precision and single-
precision) and floating points.
• The length of the character string returned is equal to the number of digits of the value plus
one character representing the sign. If the value is positive, the sign character becomes
blank.
• If the number of digits of the specified value exceeds 16 digits when a double-precision
real number is specified, or 6 digits when a single-precision real number is specified, the
value is treated in exponential format.
• The VAL function has the opposite functionality of the STR$ function.
In addition, the OCT$ and HEX$ functions convert integer data to octal or hexadecimal
strings, respectively, and return them.
Program Example
10 ' This program converts numeric values to character strings
20 A=123
30 B=456
40 C=1.23456E+07
50 A$=STR$(A)
60 B$=STR$(B)
70 C$=STR$(C)
80 PRINT "A
=";A
90 PRINT "B
=";B
100 PRINT "C
=";C
110 PRINT "A+B =";A+B
120 PRINT "A$+B$=";A$+B$
130 PRINT "C$ =";C$
140 END
11 - 384
STRing$
• • • •
Specify the value to be converted into a character
string.
• • • •
Converts the value -1.602 to the string "-1.602."
• • • •
Converts the value 3.12E08 to the string
" 3.12E08."
:
' Defines numeric values
:
' Converts into character strings
:
' Displays the results
MELSEC-Q
11 - 384

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents