8 bit hex demcial number to bit 8 bit decimal number

MrChips

Joined Oct 2, 2009
35,180
This question is not clear.
An 8-bit hexadecimal number and an 8-bit decimal number are both the same. No conversion is required.

There are 10 types of people in the world, those who understand binary and those who don't.
 

Robin Mitchell

Joined Oct 25, 2009
819
I take what he is asking is how does one take an 8 bit binary number and converts it to an easy to read decimal number like for example, FF converts to 255.

The answer is that you dont bother with logic gates or any from the standard series such as the 4000. You are best off using a PIC or AVR and driving three 7 segment displays.
 

MrChips

Joined Oct 2, 2009
35,180
The question is not clear.
An 8-bit number can represent positive integers from 0 to 255.
To represent this as binary coded decimal (BCD) digits you would require three BCD digits.
Hence you would required at least 10 bits of BCD, not eight.
 

Thread Starter

jokester4u

Joined Nov 3, 2012
26
my task is take 49 as 8 bit hexadecimal number. design the hard ware and verify the output using logic gates to convert them to its equivalent 8 bit decimal number.
 

panic mode

Joined Oct 10, 2011
5,250
ok, so you need to do conversion between binary decimal and BCD and you need to do conversion using combinational logic.

manually you would say

bindec_value = 49;
bcd_digit0 = bindec_value mod 10;
bcd_digit1 = bindec_value div 10;

so you can get the job done by implementing mod and div functions for example. you could reduce it since 10 is a constant. but this is not efficient approach.

better way is to deduce 8 functions (one for each bit of output). for example lsb is same in both cases (i just handed you sollution to 1/8 of the problem)
 

thatoneguy

Joined Feb 19, 2009
6,359
Search for binary to BCD and BCD to binary

there are several methods around, it's not trivial with logic gates.

Binary is what you are calling "Hex"
BCD is what you are calling "Binary"

BCD is Binary Coded Decimal, where each group of 4 bits represents a base 10 integer number between 0 and 9, so it can be "read" 4 bits at a time into common human numbers (base 10). BCD is not common these days. There used to be a BCD to binary logic IC. If you look for the datasheet, you'll see the solution.

Binary (not BCD) can be displayed as hex, or decimal, or any format, and uses the "full span" of available binary digit space.
 
Top