Integrated Blocks and Their Functions S5-100U
9.2.1 Code Converter : B4 - FB240 -
Use function block FB240 to convert a number in BCD (4 tetrads) with sign to a fixed-point binary
number (16 bits).
You must change a two-tetrad number to a four-tetrad number before you convert it.
• If a tetrad is not in the BCD defined range, then FB240 displays the value “0”. An error bit
message does not follow.
Table 9-2. Call and Parameter Assignments of FB240
Parameter Meaning Type Assignment
BCD BCD number I W 0 to 9999
-
I BISBCD Sign of the
BCD number
DUAL Fixed-point
number (KF)
16 bits “0”
or “1”
Q W
: JU FB240
NAME : COD:B4
BCD :
SBCD :
DUAL :
“1” for “-”
“0” for “+”
STL
9.2.2 Code Converter : 16 - FB241-
Use function block FB 241 to convert a fixed-point binary number (16 bits) to a number in BCD code
with additional consideration of the sign
. An eight-bit binary number must be transferred to a 16-bit
word before conversion.
Table 9-3. Call and Parameter Assignments of FB241
Parameter Meaning Type Assignment
DUAL
SBCD
BCD2
Binary number
Sign of the BCD
number
BCD number 4th and
5th tetrads
I W
I BI
Q BY
-32768 to+32767
2 tetrads
“1” for “-”
“0” for “+”
BCD1 BCD number tetrads
0 to 3
STL
Q W 4 tetrads
: JU FB241
NAME : COD:16
DUAL :
SBCD :
BCD2 :
BCD1 :
9-12
EWA 4NEB 812 6120-02