11 - 397 11 - 397
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' This program converts character strings to numeric values using the VAL function
20 A$="1234"
:
' Defines character strings
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$)
:
' Converts the character string "1234" to the
numeric value 1234
100 PRINT VAL(B$)
:
' Converts the character string "12.34" to
the numeric value 12.34
110 PRINT VAL(C$)
:
' Converts the character string " 1234" to
the numeric value 1234 ignoring the
leading space
120 PRINT VAL(D$)
:
' Returns 0 because the character string
does not represent a numeric value
130 PRINT VAL(E$)
:
' Treats the character string as the
hexadecimal number 4F and converts it to
the numeric value 79
140 PRINT VAL(F$)
:
' Treats only 4F as a hexadecimal number
and converts it to the numeric value 79,
because there is a space after 4F
150 PRINT VAL(G$)
:
' Treats the character string as the
hexadecimal number 4F12 and converts it
to the numeric value 20242
RUN
1234
12.34
1234
0
79
79
20242
OK
REMARK
See the STR$, HEX$, and OCT$ functions.
Содержание 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...