<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
Someone asked about that some hours ago, how to converting 4-bit
numbers to two bcd's from 01 to16.<br>
<br>
That was a nice puzzle. How to do it with few and cheap standard parts?
Here is the solution I came up with.<br>
<br>
I just use a 4bit adder and a 4 bit comparator. Outputs are two BCD's
ready to be feed into a decoder chip.<br>
<br>
The trick is to take the binary input and compare it against 8. If the
number is lower or equal to 7 I just add one (for the numbers 1 to 9),
otherwise I'll add 7. The overflow inside the adder will signal numbers
higher than 9 on the carry output and adjust the adder sum to be
between 0 and 6 again. It doesn't even need any gluelogic :)<br>
<br>
I haven't simulated it though, if you want to use it you'll better
check it..<br>
<br>
Bye,<br>
Nils<br>
<tt><br>
<font size="-1"> 74HC283<br>
+-------+<br>
>------+---------------------|A0 S0|------><br>
binary >-----+|---------------------|A1 S1|------> to low
digit<br>
input >----+||---------------------|A2 S2|------>
bcd->7segment decoder<br>
>---+|||---------------------|A3 S3|------><br>
|||| 1--|B0 |<br>
|||| +------|B1 C0|---0<br>
|||| +------|B2 |<br>
|||| 74HC85 | 0--|B3 C1|------> <br>
|||| +-------+ | +-------+ 0---> to high
digit<br>
|||+-|A0 A<B| | 0--->
bcd->7segment decoder<br>
||+--|A1 A=B| | 0---><br>
|+---|A2 A>B|----+<br>
+----|A3 | <br>
0--|B0 2|--0 <br>
0--|B1 3|--1 <br>
0--|B2 4|--0<br>
1--|B3 |<br>
+-------+<br>
<br>
</font></tt><br>
</body>
</html>