11 - 9 11 - 9
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
BIN$
Function
BINary $
• Returns a character string of the binary expression of an integer.
BIN$ ( <arithmetic expression> )
Syntax
arithmetic expression
• • • •
Specify an integer to return a character string.
A$=BIN$(10)
• • • •
Stores the character string of binary expression of
integer 10 to A$.
Examples
Decimal
10
Binary
1010
Description
• The BIN$ function returns a character string for the binary expression of an integer.
• If the value of <arithmetic expression> contains a fractional part, the fractional part is
rounded down to an integer, then converted.
Decimal
Hexadecimal
Binary
Same
result
65535
32768
32767
0
-1
-32768
FFFFH
8000H
7FFFH
0000H
FFFFH
8000H
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
0111
1111
1000
0000
0000
0000
1000
0000
0000
0000
0000
0000
0000
0000
to
to
to
to
to
to
to
to
to
A 16-bit can handle an integer of -32768 through 32767, and their hexadecimal expression is
as follows. If a decimal value of 32768 through 65535 is specified, it is regarded as specified
as -32768 through -1.