Asc ( Returns The Character Code Of The Starting Character) - Mitsubishi QD51 Programming Manual

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
ASC
Function
• Returns the character code corresponding to the starting character of the character string
expression.
ASC ( <character string expression> )
Syntax
character string expression
A=ASC("BASIC")
Examples
C=ASC("D")
• The ASC function returns the character code that corresponds to the starting character of
Description
<character string expression>.
• If an empty character string is specified in < character string expression>, an "Illegal
function call" error occurs.
Program Example
10 ' Displays the character code of the starting character of a character string
20 A$="AD51H-BASIC"
30 CODE=ASC(A$)
40 PRINT "Character =";CHR$(CODE)
50 PRINT "Decimal =";CODE
60 PRINT "Hexadecimal =";HEX$(CODE)
70 END
RUN
Character =A
Decimal= 65
Hexadecimal=41
OK
11 - 4
ASCii
• • • •
• • • •
• • • •
REMARK
• See the CHR$ and HEX$ functions.
• For converting from a character code numeric value to a character string, see the
CHR$ function.
Specify the character string to return a character
code.
Stores the character code (42
character B of the character string to A.
Stores the character code (44
C.
:
' Defines the character string
:
' Returns the character code
:
' Displays the character
:
' Character code (decimal)
:
'
MELSEC-Q
) of the starting
H
) of character "D" to
H
(hexadecimal)
11 - 4

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents