11 - 155 11 - 155
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
OCT$
Function
OCTal $
• Converts a numeric value into a character string variable in octal notation.
OCT$ (<numeric expression>)
Syntax
numerical expression
• • • •
Specify a value within the range between -32768 and
65535.
Note that numbers from 32768 to 65535 are the
same as the values from -32768 to -1 (8000
H
to
FFFF
H
).
Examples
PRINT OCT$(10)
• • • •
Converts decimal number 10 into octal and displays
the result.
Description
• The OCT$ function converts a numeric value to a character string variable in octal notation.
• Digits after the decimal point are truncated if a decimal point is included in the value in
<numeric expression>.
• Octal and decimal correspond as follows.
Octal
0
1
2
3
4
5
6
7
10
11
12
Decimal
0
1
2
3
4
5
6
7
8
9
10
Program Example
10 ' Converts a decimal number to an octal number
20 A=100
:
'Defines a value
30 A$=OCT$(A)
:
'Converts into an octal number
40 PRINT "Decimal number=";A
50 PRINT "Octal number=";A$
60 END
RUN
Decimal number=100
Octal number=144
OK