Mitsubishi Electronics FX3G User Manual

Page of 964
265
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
9 Move and Compare – FNC 10 to FNC 19
9.9 FNC 18 – BCD / Conversion to Binary Coded Decimal
1
Introdu
ction
2
Ov
ervi
ew
3
Instruction 
Li
st
4
D
evices 
in Det
ai
l
5
Specifi
ed the
De
vice
 &
 
C
onst
ant
6
Bef
ore
 
Pr
og
ra
mmi
ng
7
Bas
ic 
Instruction
8
FN
C00-FN
C0
9
Program Fl
ow
9
FNC
10-FN
C19
Mov
e & Com
pare
10
FNC
20-FNC
29
Arith. & Lo
gi
Operati
on
2. 32-bit operation (DBCD and DBCDP)
This instruction converts the binary (BIN) data of [
+1, 
] into binary-coded decimal (BCD) data, and
transfers the converted BCD data to [
+1, 
].
• The data of [
+1, 
] can be converted if it is ranging from K0 to K99999999 (BCD). 
• The table below shows digit specification for [
+1, 
] and [
+1, 
].
Related instruction
Cautions
1. When using SEGL (FNC 74) or ARWS (FNC 75) instruction
Because conversion between binary-coded decimal data and binary data is automatically executed in SEGL (FNC 74)
and ARWS (FNC 75) instructions, BCD instruction is not required.
2. Handling of BCD inputs and outputs
Binary data is used in all operations in PLCs including arithmetic operations (+, 
−, × and ÷), increment and decrement
instructions.
• When receiving the digital switch information in the binary-coded decimal (BCD) format into a PLC, use BIN (FNC 
19) instruction for converting BCD data into binary data.
• When outputting data to the seven-segment display unit handling binary-coded decimal (BCD) data, use BCD (FNC 
18) instruction for converting binary data into BCD data.
Errors
In BCD or BCDP (16-bit type) instructions, an operation error occurs when the 
 value is outside the range from
0 to 9999.
In DBCD or DBCDP (32-bit type) instructions, an operation error occurs when the 
 value is outside the range
from 0 to 99,999,999.
[
+1,
]
Number of digits
Data range
K1Y000
1
0 to 9
K2Y000
2
00 to 99
K3Y000
3
000 to 999
K4Y000
4
0000 to 9999
K5Y000
5
00000 to 99999
K6Y000
6
000000 to 999999
K7Y000
7
0000000 to 9999999
K8Y000
8
00000000 to 99999999
Instruction
Function
BIN (FNC 19)
Converts binary-coded decimal (BCD) data into binary (BIN) data.
   
S
   
S
   
D
   
D
   
S
   
S
   
S
   
S
   
D
   
D
FNC 18
DBCD
When "K8Y000" is specified
Command
input
PLC
DBCD (FNC 18)
Y034 Y030 Y024 Y020 Y014 Y010 Y004 Y000
Y037 Y033 Y027 Y023 Y017 Y013 Y007 Y003
BIN
BCD
  D
  D
   
S
   
S