11 - 83 11 - 83
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
HEX$
Function
HEXadecimal $
• Converts a decimal number to a hexadecimal character string.
HEX$ ( <numeric expression> )
Syntax
numeric expression
• • • •
Specify within a range from -32768 to 65535.
Values from 32768 to 65535 are the same as
values from -32768 to -1 (8000
H
to FFFF
H
),
however.
Examples
PRINT HEX$(200)
• • • •
Converts 200 to C8 in hexadecimal and displays it.
Description
• The HEX$ function converts a decimal umber to a hexadecimal character string.
• The fractional part of the numeric expression is truncated, then converted into an integer.
• The hexadecimal numbers and decimal numbers correspond as follows:
Hexadecimal number
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
Decimal number
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16
Program Example
10 ' Converts a decimal number to a hexadecimal number
20 A=200
:
' Defines a numeric value
30 PRINT "Decimal number=";A
40 A$=HEX$(A)
:
' Converts into a hexadecimal number
50 PRINT "Hexadecimal number=";A$
60 END
RUN
Decimal number = 200
Hexadecimal number=C8
REMARK
See the VAL, BIN$ and OCT$ functions, and Section 2.7.2.
Add "&H" before a numeric number to express a hexadecimal numeric number.
Example
Decimal
Hexadecimal
200
&HC8
Use the VAL function to convert a hexadecimal number of a character string into a
decimal number.
Example
Decimal
200
VAL( "&HC8" )
Always add "&H".
Содержание 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...