Hi again,
This should get you started. This is the starting work for converting 4 bit binary to BCD. The inputs are a,b,c,d and the output bits are 7,6,5,4,3,2,1,0, where 3,2,1,0 are the units BCD digit and 7,6,5,4 are the tens BCD digit.
We start by examining bit 0 for every possible combination of the inputs. Every time we see a '1' in that column we write a boolean expression for that bit based on each and EVERY input bit (although we later can skip 'a'). We do this with all 16 input combinations and thus we end up with 16 or less expressions, which we then logically "OR" together. We then try to simplify that expression using boolean algebra.
You can see i already did bits 0 and 1, and you can also see that bit 0 reduced to simply 'a' (one input). Bit 1 was a little more difficult but that one only required a few expressions. Next, you can write expressions every place i put an asterisk '*' in the third truth table, then proceed to do the other bits the same way.
You'll note that input bit 'a' is not required in the expressions after the first truth table. This is the way binary to BCD always works as an odd binary is also an odd BCD, and odd and even are determined by bit 'a' of the input, no matter how many bits you have to convert. This means for 4 bit conversion we only have to consider b,c, and d, and for 5 bit we would only have to consider input bits e,d,c,b, and so on.
Code:
INPUT OUTPUT
dcba 7654 3210
0000 0000 0000
0001 0000 0001 d'c'b'a
0010 0000 0010
0011 0000 0011 d'c'ba
0100 0000 0100
0101 0000 0101 d'cb'a
0110 0000 0110
0111 0000 0111 d'cba
1000 0000 1000
1001 0000 1001 dc'b'a
1010 0001 0000
1011 0001 0001 dc'ba
1100 0001 0010
1101 0001 0011 dcb'a
1110 0001 0100
1111 0001 0101 dcba
Bit0=d'c'b'a+d'c'ba+d'cb'a+d'cba+dc'b'a+dc'ba+dcb'a+dcba
which reduces to:
Bit0=a
INPUT OUTPUT
dcba 7654 3210
0000 0000 0000
0001 0000 0001
0010 0000 0010 d'c'b
0011 0000 0011 d'c'b
0100 0000 0100
0101 0000 0101
0110 0000 0110 d'cb
0111 0000 0111 d'cb
1000 0000 1000
1001 0000 1001
1010 0001 0000
1011 0001 0001
1100 0001 0010 dcb'
1101 0001 0011 dcb'
1110 0001 0100
1111 0001 0101
Bit1=d'c'b+d'cb+dcb'
which may be reduced also.
INPUT OUTPUT
dcba 7654 3210
0000 0000 0000
0001 0000 0001
0010 0000 0010
0011 0000 0011
0100 0000 0100 * write expression here
0101 0000 0101 * ditto
0110 0000 0110 * ditto
0111 0000 0111 * ditto
1000 0000 1000
1001 0000 1001
1010 0001 0000
1011 0001 0001
1100 0001 0010
1101 0001 0011
1110 0001 0100 * ditto
1111 0001 0101 * ditto
Bit2= (logically OR all your statements here and then reduce if possible)