Conversion instructions
647
Part III FP Instructions
F80_BCD
16-bit BIN -> 4-digit BCD conversion
·········
15
000
12
0
11
000
8
0
7
000
4
1
3
000
0
0
16
·········
15
000
12
0
11
000
8
0
7
000
4
1
3
011
0
0
0
016
Source [s]: 16
Bit position
Bit position
Binary data
Binary data
BCD Hex code
Decimal
Conversion (to BCD code)
Destination [d]: 16#16 (BCD)
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
See also:
BCD data in the online help
PLC types Availability of F80_BIN (see page 1326)
Variable Data type Function
s ANY16 binary data (source), range: 0 to 9999
d WORD 16-bit area for 4-digit BCD code (destination)
For Relay T/C Register Constant
s WX WY WR WL SV EV DT LD FL dec. or hex.
d - WY WR WL SV EV DT LD FL -
No. IEC address Set If
R9007 %MX0.900.7 permanently
R9008 %MX0.900.8 for an instant
16-bit binary data outside the range of 0
(16#0) to 9999 (16#270F) is converted
Description
Converts the 16-bit binary data specified by s to the BCD code that expresses 4-digit decimals if
the trigger EN is in the ON-state. The converted data is stored in d. The binary data that can be
converted to BCD code are in the range of 0 (0 hex) to 9999 (270F hex).
Data types
Operands
Error flags