Example
Binary 00111000
Convert to Decimal 56
Convert to BCD by using groups of four binary numbers for each digit
5 6
0101 0110
All possible 2-bit numbers ... 0, 1, 2, and 3 ... are the same in BCD and binary. No conversion is required.
In BCD each digit of a decimal number is coded as a separate 4 bit binary number between 0 and 9.For example:Decimal 12 in BCD is shown as 0001 0010 (Binary 1 and Binary 2), in Binary it is 1100.
In BCD it is 00100111 In Binary, which is what you mean, it is 101111
The advantage of encoding a decimal number in Binary-Coded Decimal (BCD) compared to straight binary is that BCD allows for easier human readability and manipulation of decimal numbers. Each decimal digit is represented by its own binary sequence, making it straightforward to convert between decimal and BCD without complex calculations. This is particularly useful in applications such as digital displays and calculators, where decimal output is required. Additionally, BCD can simplify certain arithmetic operations involving decimal numbers.
Write a program to convert a 2-digit BCD number into hexadecimal
BCD is used for binary output on devices that only display decimal numbers.
41 in decimal is 0100 0001 in BCD (this is 8 bits not 6 bits)41 in decimal is 101001 in binary (this is 6 bits, but binary not BCD)There is no 6 bit BCD representation of the decimal number 41!
BCD (Binary Coded Decimal) output can be generated using decimal-to-BCD conversion algorithms. One common method involves dividing the decimal number by 10 and storing the remainder as the Binary Coded Decimal digit. This process is repeated until all decimal digits are converted into BCD form. Alternatively, some microcontrollers have built-in instructions to directly convert decimal numbers to BCD format.
Binary coded decimal (BCD) is easier to convert between displayed or printed form than is pure binary.
WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL
A: A Binary code represent a binary number 0.1.2.4.8. etc. that is why it is called a weighted number
To convert the decimal number 438 into Binary-Coded Decimal (BCD) form, we first represent each digit separately in binary. The digits of 438 are 4, 3, and 8, which in BCD are 0100, 0011, and 1000, respectively. To achieve odd parity, we need to ensure the total number of 1s in each BCD representation is odd. Therefore, we add an additional 1 to the BCD of 4 (making it 0101) and leave the BCDs of 3 (0011) and 8 (1000) unchanged, resulting in the odd parity BCD representation of 438 as 0101 0011 1000.