11 - 4 11 - 4
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ASC
Function
ASCii
• Returns the character code corresponding to the starting character of the character string
expression.
ASC ( <character string expression> )
Syntax
character string expression
• • • •
Specify the character string to return a character
code.
A=ASC(“BASIC”)
• • • •
Stores the character code (42
H
) of the starting
character B of the character string to A.
Examples
C=ASC(“D”)
• • • •
Stores the character code (44
H
) of character “D” to
C.
Description
• The ASC function returns the character code that corresponds to the starting character of
<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"
:
' Defines the character string
30 CODE=ASC(A$)
:
' Returns the character code
40 PRINT "Character =";CHR$(CODE)
:
' Displays the character
50 PRINT "Decimal =";CODE
:
' Character code (decimal)
60 PRINT "Hexadecimal =";HEX$(CODE)
: '
(hexadecimal)
70 END
RUN
Character =A
Decimal= 65
Hexadecimal=41
OK
REMARK
• See the CHR$ and HEX$ functions.
• For converting from a character code numeric value to a character string, see the
CHR$ function.
Содержание 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...