0% found this document useful (0 votes)
81 views1 page

BCD To Binary

1) BCD (Binary Coded Decimal) represents each decimal digit in a number as a 4-bit binary number. For example, 1895 in BCD would be 0001 1000 1001 0101. 2) To convert a BCD number back to decimal, each set of 4 bits is multiplied by successive powers of 10 and summed. 3) To encode 67 in BCD: isolate the ones and tens digits (6 and 7), shift the tens digit to the ones place by moving its bits right, multiply the tens digit by 10, and add the digits.

Uploaded by

faisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views1 page

BCD To Binary

1) BCD (Binary Coded Decimal) represents each decimal digit in a number as a 4-bit binary number. For example, 1895 in BCD would be 0001 1000 1001 0101. 2) To convert a BCD number back to decimal, each set of 4 bits is multiplied by successive powers of 10 and summed. 3) To encode 67 in BCD: isolate the ones and tens digits (6 and 7), shift the tens digit to the ones place by moving its bits right, multiply the tens digit by 10, and add the digits.

Uploaded by

faisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

bcd no is one in which each digit in the no is encoded in its 4 digit binary form

for example
1895 in bcd is 0001 1000 1001 0101
from this if we wish to convert back to 1895 multiply each set of 4 binary numbers(decoded in their
decimal form) by successive powers powers of 10
so we have 1x103+8x102+9x10+5=1895
if we have 67 in bcd mask 6 and store 7 in a register
then mask 7 and move bits of 6 to the right .then multiply them with 10 then add 7

(2200H) = 67H
(2300H) = 6 x OAH + 7 = 3CH + 7 = 43H
LDA 2200H
MOV B,A
ANI 0F
MOV C,A
MOV A,B
ANI F0
RRC//used to move all bits in the acc to right by one position
RRC//using them 4 times moves the bits from higher nibble to lower nibble entirely
RRC
RRC
MOV B,A
MVI D 0A
LOOP:ADD B
DCR D
JNZ LOOP
ADD C
STA 2100
HLT

You might also like