How to convert a binary number into BCD number directly and vice-versa, without converting it into any other number system?
Submitted by: AdministratorIt depends on the range. An algorithm can be used.
For a number in the range of 0 to 19 (decimal), the following algorithm can be used:
if a<10
a_BCD=a;
else if a<20
a_BCD=a+0x06;
end
for example if a=0x0E, then a_BCD=0x0E+0x06=0x14, which is the BCD representation of 0x0E.
This could be generalized for a number in the range of 0 to 99: a_BCD=a+n*0x06, where 10*n<=a<10*(n+1).
Submitted by: Administrator
For a number in the range of 0 to 19 (decimal), the following algorithm can be used:
if a<10
a_BCD=a;
else if a<20
a_BCD=a+0x06;
end
for example if a=0x0E, then a_BCD=0x0E+0x06=0x14, which is the BCD representation of 0x0E.
This could be generalized for a number in the range of 0 to 99: a_BCD=a+n*0x06, where 10*n<=a<10*(n+1).
Submitted by: Administrator
Read Online Electronics Engineering Job Interview Questions And Answers
Top Electronics Engineering Questions
☺ | How to convert a JK flip flop into SR flip flop and vice versa, a SR flip flop into D or T flip flop and vice versa? |
☺ | The Cost of storing a bit is minimum in |
☺ | 74LS244 is _____? |
☺ | What is the Value of binary number with n digit, all of which are unity? |
☺ | What is Pulse Width Modulation? |
Top Best Engineering Categories
☺ | Mechanical Engineering Interview Questions. |
☺ | Civil Engineering Interview Questions. |
☺ | Chemical Engineering Interview Questions. |
☺ | Electrical Engineering Interview Questions. |
☺ | Automobile Engineering Interview Questions. |