Mitsubishi QD51 Programming Manual page 253

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
HEX$
Function
• Converts a decimal number to a hexadecimal character string.
HEX$ ( <numeric expression> )
Syntax
numeric expression
PRINT HEX$(200)
Examples
• The HEX$ function converts a decimal umber to a hexadecimal character string.
Description
• 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
Decimal number
Program Example
10 ' Converts a decimal number to a hexadecimal number
20 A=200
30 PRINT "Decimal number=";A
40 A$=HEX$(A)
50 PRINT "Hexadecimal number=";A$
60 END
RUN
Decimal number = 200
Hexadecimal number=C8
11 - 83
HEXadecimal $
0
0
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.
Decimal
Example
Use the VAL function to convert a hexadecimal number of a character string into a
decimal number.
Example
VAL( "&HC8" )
Always add "&H".
• • • •
Specify within a range from -32768 to 65535.
Values from 32768 to 65535 are the same as
values from -32768 to -1 (8000
however.
• • • •
Converts 200 to C8 in hexadecimal and displays it.
1
2
3
4
5
6
1
2
3
4
5
6
:
' Defines a numeric value
:
' Converts into a hexadecimal number
Hexadecimal
200
&HC8
Decimal
MELSEC-Q
to FFFF
H
7
8
9
A
B
C
7
8
9 10 11 12 13 14 15 16
200
),
H
D
E
F 10
11 - 83

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents