Computer Science Canada

3 Bit Binary Adder Project

Author:  durdur [ Tue Jan 06, 2009 10:36 am ]
Post subject:  3 Bit Binary Adder Project

Here is the description

The program will request the user to input two numbers between 0 and 7 to be added together. Each number will be sent over the parallel port output pins as a 3 bit binary number to the 3 bit adder circuit.
The program will display a graphical representation of the sum as displayed by your 3 bit adder circuit. Depending on your hardware circuit, the sum will be displayed either as four LEDs or as a 7 segment display.

I decided to go with 3 bit adder instead of 7 segment display

Here is what i got so far

Turing:

var number1, number2 : real

loop
    put "Enter a number"
    get number1
    exit when number1 > 7
    put "Enter another number"
    get number2
    exit when number2 > 7
    put "The sum is " ..
    put number1 + number2
    %Makes 0 in binary
    drawfilloval (100, 250, 50, 50, gray) % Circle 1
    drawfilloval (250, 250, 50, 50, gray) % Circle 2
    drawfilloval (400, 250, 50, 50, gray) % Circle 3
    delay (500)
    %Makes 1 in binary
    drawfilloval (100, 250, 50, 50, gray) % Circle 1
    drawfilloval (250, 250, 50, 50, gray) % Circle 2
    drawfilloval (400, 250, 50, 50, brightred) % Circle 3
    delay (500)
    %Makes 2 in binary
    drawfilloval (100, 250, 50, 50, gray)
    drawfilloval (250, 250, 50, 50, brightred)
    drawfilloval (400, 250, 50, 50, gray)
    delay (500)
    %Makes 3 in binary
    drawfilloval (100, 250, 50, 50, gray) % Circle 1
    drawfilloval (250, 250, 50, 50, brightred) % Circle 2
    drawfilloval (400, 250, 50, 50, brightred) % Circle 3
    delay (500)
    %Makes 4 in binary
    drawfilloval (100, 250, 50, 50, brightred) % Circle 1
    drawfilloval (250, 250, 50, 50, gray) % Circle 2
    drawfilloval (400, 250, 50, 50, gray) % Circle 3
    delay (500)
    %Makes 5 in binary
    drawfilloval (100, 250, 50, 50, brightred) % Circle 1
    drawfilloval (250, 250, 50, 50, gray) % Circle 2
    drawfilloval (400, 250, 50, 50, brightred) % Circle 3
    delay (500)
    %Makes 6 in binary
    drawfilloval (100, 250, 50, 50, brightred) % Circle 1
    drawfilloval (250, 250, 50, 50, brightred) % Circle 2
    drawfilloval (400, 250, 50, 50, gray) % Circle 3
    delay (500)
    %Makes 7 in binary
    drawfilloval (100, 250, 50, 50, brightred) % Circle 1
    drawfilloval (250, 250, 50, 50, brightred) % Circle 2
    drawfilloval (400, 250, 50, 50, brightred) % Circle 3
    delay (500)
end loop

Author:  Insectoid [ Tue Jan 06, 2009 4:32 pm ]
Post subject:  RE:3 Bit Binary Adder Project

You need parallelput.


: