Mitsubishi QD51 Programming Manual page 567

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program converts character strings to numeric values using the VAL function
20 A$="1234"
30 B$="12.34"
40 C$=" 1234"
50 D$="ABC"
60 E$="&H4F
70 F$="&H4F 56"
80 G$=E$+"12"
90 PRINT VAL(A$)
100 PRINT VAL(B$)
110 PRINT VAL(C$)
120 PRINT VAL(D$)
130 PRINT VAL(E$)
140 PRINT VAL(F$)
150 PRINT VAL(G$)
RUN
1234
12.34
1234
0
79
79
20242
OK
11 - 397
REMARK
See the STR$, HEX$, and OCT$ functions.
:
' Defines character strings
:
' Converts the character string "1234" to the
numeric value 1234
:
' Converts the character string "12.34" to
the numeric value 12.34
:
' Converts the character string " 1234" to
the numeric value 1234 ignoring the
leading space
:
' Returns 0 because the character string
does not represent a numeric value
:
' Treats the character string as the
hexadecimal number 4F and converts it to
the numeric value 79
:
' Treats only 4F as a hexadecimal number
and converts it to the numeric value 79,
because there is a space after 4F
:
' Treats the character string as the
hexadecimal number 4F12 and converts it
to the numeric value 20242
MELSEC-Q
11 - 397

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents