Mitsubishi QD51 Programming Manual page 82

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

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM
3 - 41
(2) Finding the length of a character string
The LEN function is used to find the length of a character string.
10 A$= "ABCDE"
20 A= LEN (A$)
30 PRINT A
40 END
RUN
5
OK
(3) Converting characters to ASCII code equivalents
Each character used in BASIC has a corresponding ASCII code number.
(See Appendix 4.1)
For example, for alphabet characters, the codes correspond as follows:
[Character]
A
B
:
The ASC function and CHR$ function are used for conversion between ASCII
codes and characters.
Example
OK
PRINT ASC( " A" )
65
OK
PRINT CHR$(65)
A
OK
• Only character constants, character arrays, or character conversion can be specified
inside the parentheses of an ASC function.
Only numeric constants, numeric arrays, or variables can be specified inside
the parentheses of a CHR$ function.
• Specifying number 31 or less in the parentheses in a CHR$ function will produce
control characters described in Section 3.13.1.
• Full-byte characters cannot be used with the ASC function.
[Code]
65
66
:
"A"
Character
MELSEC-Q
ASC
65
Value
CHR$
3 - 41

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents