Basic Function Instruction
6 -3 8
FUN 21
D
P
→
BIN
BCD TO BIN CONVERSION
(Converts BCD data of the device specified at S into BIN and stores the result in D)
FUN 21
D
P
→
BIN
Operand
S : The register to be converted
D : The register to store the converted data
(BIN 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
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3919
R3920
∣
R4047
R4096
∣
R4127
R4128
∣
R4135
R4136
∣
R4167
R5000
∣
R8071
D0
∣
D4095
S
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
D
○
○
○
○
○
○
○
○
○
○
○
*
○
*
○
●
The decimal (BCD) data must be converted to binary (BIN) data first in order for PLC to accept the data
which is originally in decimal unit (BCD code) inputted from external device such as digital switch because
the BCD data can not be accepted by PLC for its operations.
●
Converts BCD data of the device specified at S into BIN 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 in BCD, then the error flag
FO0 is set to 1 and the old data of D are retained.
●
Constant is converted to BIN automatically when store in program and can not be used as a source
operand of this function.
Example
16-bit BCD to BIN conversion
Ladder diagram
Key operations
Mnemonic code
S :
D : R
WX 0
1
21P. BIN
EN
X0
ERR
ORG
ORG X 0
FUN 21P
S : WX 0
D : R
1
X15 X0
↓
1
2
3
4
↓
S WX0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Ø
X0
=
B15 B0
↓
↓
D
R1 0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0
Содержание 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 ...