# Binary questions!

Need Help plss.... in binary question

Design the following digital circuits using AND, OR and NOT gates:

a) A binary addtition- substraction circuit that adds or subtracts two 4 bit binary numbers. The circuit has a selection bit that controls whether addition or substraction is to be performed.

b) Draw a combinational circuit that convverts a single hexadecimal number to an equivalent BCD (binary coded decimal)number.

c) A 2 bit counter that counts till 2 that is the counting states are: 00,01,10,00,01,10,00.. .. .. etc

Thanks

• You'd probably have better luck on a hardware or assembly page, though I wouldn't be too surprised if one of these basic'ers knew a bit more than me and has experience in those areas (I sure as heck don't).

: Need Help plss.... in binary question
:
: Design the following digital circuits using AND, OR and NOT gates:
:
: a) A binary addtition- substraction circuit that adds or subtracts two 4 bit binary numbers. The circuit has a selection bit that controls whether addition or substraction is to be performed.
:
: b) Draw a combinational circuit that convverts a single hexadecimal number to an equivalent BCD (binary coded decimal)number.
:
: c) A 2 bit counter that counts till 2 that is the counting states are: 00,01,10,00,01,10,00.. .. .. etc
:
: Thanks
:

• : Need Help plss.... in binary question
:
: Design the following digital circuits using AND, OR and NOT gates:
:
: a) A binary addtition- substraction circuit that adds or subtracts two 4 bit binary numbers. The circuit has a selection bit that controls whether addition or substraction is to be performed.
:
: b) Draw a combinational circuit that convverts a single hexadecimal number to an equivalent BCD (binary coded decimal)number.
:
: c) A 2 bit counter that counts till 2 that is the counting states are: 00,01,10,00,01,10,00.. .. .. etc
:
: Thanks

a)
This will show you how to build a 4-bit adder:
http://people.ucsc.edu/~gyao/project.ppt

This will show you how to convert it to add or subtract:

b)
?? - I'm thinkin! Hmmmm? How 'bout...
pass the four inputs through 2input and gates. The second gate inputs are all tied together to form a "4-bit switch".
Now, decode the A,B,C,D, and E states of the 4-bit input and present them as the second 4-bit BCD digit. (actually only need 3 bits as the BCD digit value will never be above five.) A three input and gate on the msd BCD can be used to turn off the lsd BCD switch to make that digit equal to zero.

.... that's kind of a ramble, but it might give you some ideas!

c)
will this work??.....
use and / or / inverters to build j-k flip flops...
use two flipflops as a 2-bit counter
connect the inputs of a 2-input and gate to the ff outputs.
connect the output of the and gate to the reset inputs of both ff's

Enjoy!

rg
• [b][red]This message was edited by Folker Fritz at 2003-10-13 15:19:34[/red][/b][hr]
: Need Help plss.... in binary question
:
: Design the following digital circuits using AND, OR and NOT gates:
:
: two 4 bit binary numbers. The circuit has a selection bit that
: controls whether addition or substraction is to be performed.

'i whould try to do this with hex values like:
A& = &H03 + &H04
PRINT A\$

'or you can try to extract each bit and then add it:
B\$ = CHR\$(122)
B = ASC(B\$)
FOR temp = 8 TO 1 STEP -1
IF B >= (2 ^ temp) / 2 THEN WRIT\$ = WRIT\$ + "1" ELSE WRIT\$ = WRIT\$ + "0"
IF B >= (2 ^ temp) / 2 THEN B = B - (2 ^ temp) / 2
NEXT
'WRIT\$ contains now every bit: 01111010
'you can now use the bit you want, here the first 4 for example:
c = c + VAL(MID\$(WRIT\$, 1, 1)) * 1
c = c + VAL(MID\$(WRIT\$, 2, 1)) * 2
c = c + VAL(MID\$(WRIT\$, 3, 1)) * 4
c = c + VAL(MID\$(WRIT\$, 4, 1)) * 8
PRINT "Value of first 4 bits:", c

: b) Draw a combinational circuit that convverts a single hexadecimal number to an equivalent BCD (binary coded decimal)number.

'HexToValue:
VAL( "&H" + h )
'BinToValue:
VAL( "&B" + h )
'HexToBin:
BIN\$( VAL( "&H" + h ) )
'BinToHex:
HEX\$( VAL( "&B" + h ) )

: c) A 2 bit counter that counts till 2 that is the counting states are: 00,01,10,00,01,10,00.. .. .. etc

'look at my answer for question a, you can do it the same way.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!