Binary Calculator
Binary Calculator
ABSTRACT
This project demonstrates how users can use two eight-bit unsigned integer
numbers for the four main operations of math, which are addition, subtraction,
multiplication and division. While this concept sounds simple in nature the actual task of
implementing this is complex and can be confusing. The actual math of it was easy to
understand and implement, while the input and output mapping and control was more
challenging. We came to the conclusion that an 8 bit calculator is not very useful but
after the heavy lifting, implementing the calculator states and I/O integration, it could
easily be expanded to accomplish larger more useful tasks.
I. INTRODUCTION decided, the next step was to figure out
For this project, a simple how many input values that will be used.
calculator was created. The motivation To avoid complex calculations, two
of this project was that the main math numbers would be enough. These
operations were created in the labs of values would then be converted from
this course. Other main components BCD numbers into Binary.
were a BCD to Binary converter and a
seven segment display. Some other
components also include registers to
store the data values of the two
numbers. What we learned from this
project is to clear variables in the
sensitivity of the process. Another thing
that we had to learn on our own was
how to converter BCD to Binary and
Binary to BCD. This method is called
Double-Dabble, where you convert
numbers from Binary to BCD and vise
Figure 1: 4x4 Keypad Schematic [2]
versa. We also learned how to
troubleshoot error messages from our
After the numbers go through the
project. This project can be used for any
operations, the results will be converted
person who needs to use a calculator
back from Binary to BCD and will be
for simple math, such as elementary
outputted onto a seven segment display.
school students who are just starting to
For division, if the number has a
learn basic mathematics.
remainder, the remainder will be shown
on segments 3 and 4 of the
II. METHODOLOGY
seven-segment display. Additionally, for
the seven-segment display to work with
A. Inputs and Outputs
the multiple digits, we had to create a
The first parts of this project is
multiplexer that would select each digit
the input and output values. The input
one at a time and display the correct
values’ range is determined by the
value.
number of bits this calculator is built for.
Since the decision of this calculator is
For a static system the human
eight-bit unsigned integer numbers, the
can not discern rates above 30Hz so we
range for the inputs is from 0 to 255
arbitrarily selected a value of 40kHz for
binary. Furthermore, since we are using
this scan cycle related to the operation
a 4x4 Keypad, it is further limited to the
of the seven segment display.
range, 0 to 99. Once the range was
The four mathematical operations
that were programmed were addition,
subtraction, multiplication and division.
Potential improvements
1. Using 2’s complement binary
arithmetic
2. Drop the leading zeroes on the
display
3. Institute an “all clear” and clear
function
4. Expand the arithmetic capabilities
to handle a greater number of
bits.
5. Rework the FSM and integration
of coding so it is easier to read
6. Replace the seven segment
display with LCD display for
greater functionality