Basic Function Instruction
6 -3 7
FUN 20
D
P
→
BCD
BIN TO BCD CONVERSION
(Converts BIN data of the device specified at S into BCD and stores the result in D)
FUN 20
D
P
→
BCD
Operand
S : The register to be converted
D : The register to store the converted data
(BCD code)
The S, D may combine with V, Z, P0~P9 to serve
indirect addressing
WX
WY
WM
WS TMR CTR HR
IR
OR
HR HSCR RTCR SR ROR DR
K
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3804
∣
R3903
R3940
∣
R3919
R3920
∣
R4047
R4096
∣
R4127
R4128
∣
R4135
R4136
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32 bit
+/- number
S
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
D
○
○
○
○
○
○
○
○
○
○
○
*
○
*
○
●
FB-PLC uses binary code to store and to execute calculations. If want to send the internal PLC data to the
external displays such as seven-segment displays, it is more convenient for us to read the result on screen
by converting the BIN data to BCD data. For example, it is more clear for us to read the reading "12"
instead of the binary code "1100."
●
Converts BIN data of the device specified at S into BCD and writes the result in D when the operation
control input "EN" =1 or "EN
↑
" (
P
instruction) from 0 to 1. If the data in S is not a BCD value (0~9999 or
0~9999999), then the error flag FO0 is set to 1 and the old data of D are retained.
Example
16-bit BIN to BCD conversion
Ladder diagram
Key operations
Mnemonic code
S :
D : R
9999
20.
BCD
EN
X0
ERR
0
ORG
ORG X 0
FUN 20
S : 9999
D : R 0
B15 B0
↓
↓
S
K
0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
Ø
X0
=
1
B15 B0
↓
↓
D
R0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
Содержание FBs-CBE
Страница 78: ...MEMO ...
Страница 111: ...4 6 X0 X1 Node A Y0 Y1 Node B differential down Incerse differential up t Scan time Inverse t t ...
Страница 141: ...Basic Function Instruction 6 16 FUN 2 SKP SKIP START FUN 2 SKP Y2 Y1 Y0 T201 10S X0 X1 X2 0 10 0 ...
Страница 305: ...MEMO ...
Страница 348: ...MEMO ...