(Fun21) - FATEK FBS Series Manual

Plc
Hide thumbs Also See for FBS Series:
Table of Contents

Advertisement

Basic Function Instruction
FUN 21
D P
(Converts BCD data of the device specified at S into BIN and stores the result in D)
→BIN
WX
WY
Range
WX0
WY0
Ope-
rand
WX240
WY240
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↑" (
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
X0
EN
BCD TO BIN CONVERSION
WM
WS
TMR CTR
WM0
WS0
T0
WM1896
WS984
T255
P
instruction) from 0 to 1. If the data in S is not in BCD, then the error flag
21P. BIN
S :
WX
0
ERR
1
R
D :
X15
S WX0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
B15
D
R1
0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0
HR
IR
OR
C0
R0
R3840
R3904
C255
R3839
R3903
R3919
Key operations
ORG
1
2
X0=
6 - 3 8
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
HR
HSCR RTCR
SR
R3920
R4096
R4128
R4136
R4047
R4127
R4135
R4167
○ *
Mnemonic code
ORG
FUN
S : WX
D : R
X0
3
4
B0
FUN 21
D P
→BIN
ROR
DR
R5000
D0
R8071
D4095
○ *
X
0
21P
0
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents