BTI
CLASS
I
O
2.18
BCD to Integer Conversion (BTI)
Description
This FB converts an input BCD value to an integer and puts the result in the OUT output.
Conversion
A 2-digit number on BCD has the following format:
BIT7-BIT6-BIT5-BIT4 _____BIT3-BIT2-BIT1-BIT0
Each set of 4 bits composes a digit. For example: the number 10. If expressed in the BCD code it is
written as 10. The first digit can be written in the binary form as 0001, and the second as 0000. So,
10BCD= 0001 000Binary. It is common to confuse the BCD code with the binary representation.
However, each group of 4 bits only represents one digit varying from 0 to 9. There can't be a
representation on BCD like 12 9BCD, even though 12 can be expressed by 4 bits. The BCD code is
typically used in 7 segment displays. Each segment represents a BCD digit.
representation may be extended to N digits, always noting that each digit varies only from 0 to 9.
BCD TO INTEGER CONVERSION
MNEM
DESCRIPTION
EN
INPUT ENABLE
IN
BLOCK INPUT
ENO
OUTPUT ENABLE
OUT
INPUT VALUE CONVERTED TO INTEGER
I: Input. P: Parameter. O: Output. V: Variable
IF EN=1 THEN
ENO := 1
OUT = INTEGER( IN)
ELSE
ENO := 0
OUT := 0
TYPE
BOOLEAN
ANY_BIT
BOOLEAN
INT
Function Blocks
The above
Need help?
Do you have a question about the Logic View and is the answer not in the manual?
Questions and answers