Graphing Calculator
ECE 476 Final Project, Spring 2003
Jeannette Lukito :: Jonathan Wang

:Introduction:
:High.Level.Design:
:Program.Design:
:Hardware.Design:
:Results:
:Pictures:
:Conclusions:
:Appendix:
:Code.of.Ethics:











Jeannette Lukito
jl259@cornell.edu
Jonathan Wang
jdw24@cornell.edu

High-Level Design

Rationale And Source of Project Idea
     As a 476 final project, we decided to design our own graphing calculator that will contain two modes, scientific mode and graphing mode. Without using the C library, we would like to challenge ourselves to find a way to implement most of our functions. Since we are somewhat exposed to TV generation signals in our previous lab, we would also like to utilize this knowledge into our final project as the main instrument to display our calculator result. Using two keypads, we hope to be able to communicate calculator functions from the user through the keypads to the TV.

Logical Structure
     The basic structure design of the device is to take input from 2 4x4 keypads and display the inputs and the results on a TV screen using NTSC signals.


Click on figure for larger picture

Our graphing calculator will be divided into two distinct modes: scientific mode and graphing mode. Upon start up, program will take the user to the scientific mode first. The functionalities of each of the modes are as follows:
Scientific Mode
     In scientific mode, the TV will simply display border with a title that indicates to the user that he is in the scientific mode. Within this mode, users can enter a single operand function which includes these functions in the following format:
  • Addition: A+B
  • Substraction: A-B
  • Division: A/B
  • Multiplication: A*B
  • Sin: A sin B or sin B
  • Cos: A cos B or cos B
  • Tan: A tan B or tan B
  • ASin: A Asin B or Asin B
  • ACos: A Acos B or Acos B
  • ATan: A Atan B or Atan B
  • Power: A^B
  • Exponential: e^B
Where A and B can be either negative or positive real values either integers or floating point values. Each window will support specific options that user can user use to operate the calculator:
  • Clear: This option will automatically clear all of the operation typed within the mode for the user to start all over with a fresh operation.
  • Del: This option will delete one at time in case the user has entered a mistake
  • y= (graphing mode): The user will be provided a button that will automatically go to scientific mode when this certain button is pressed.
  • Enter: After user has entered their desired function to calculate, user will need to press enter to indicate to the program that he is done.
  • 'N/P': User can prefer to use a more precised method in their result by bypassing our approximations and using the math.h library.
  • 'Precision': This button toggles between "precision mode" and the normal mode of operation. In precision mode the calculator will use math.h functions instead of the series expansions to insure a more accurate result. A letter in the bottom right hand corner of the screen indicates which mode you are in. A 'N' indicates normal mode, while a 'P' indicates Precision mode.
Graphing Mode
     In graphing mode, again, the TV will simply display a border with a title that indicates that user is in graphing mode. The graphing mode can take one single function and plot it out in an optimum viewing range calculated by the program. The inputs are as follows:
  • Sin: A sin(Bx + C)
  • Cos: A cos(Bx + C)
  • Tan: A tan(Bx + C)
  • Asin: A Asin(Bx + C)
  • Acos: A Acos(Bx + C)
  • Atan: A Atan(Bx + C)
  • Poly: (Ax + B)^C
  • Exponential: A exp(Bx)
  • Ln: A ln(Bx)
Similar to the scientific mode, A, B and C parameters can either be positive or negative real integers or floats. After user has entered the desired functions and its parameters, the graphing mode will immediately switch to a graphing screen and attempt to maximize viewing window while plotting the function. As in the scientific mode, user is provided with the same choice of buttons with one additional button. These buttons are:
  • Clear: If graphing mode is in the enter function screen, screen will clear the function. If program is on the screen that displays the axis and a particular graph, clear will bring the user back to enter function screen of the graphing mode.
  • Del: Similar as before, user is able to delete an input mistake
  • Enter: This button is used every time the user is entering the parameters of the function. The last enter will take the user to see the plot of the function that he has inputted.
  • Exit: In the plot screen, the program will take the user back to the enter function screen of the graphing mode. If user is in the enter function screen already, the user can exit and go back to scientific mode.
  • 'Dot/line': This button toggles between a dotted graph and a connected graph. The top right hand corner of the screen will read 'DOT' or 'LINE' depending on which mode you are currently in.

Although one cannot toggle between normal/precision in graphing mode, whatever mode you were on in scientific mode carries over to graphing as well.

Background Math
     We thought it would be somewhat challenging to try finding a way to calculate our trig functions rather than using the C math library. In order to this, we have decided on the Maclaurin series taken from mathworld.com. Maclaurin series is a basically a Taylor series expansion of a function f(x) about a point x=x0 where x0=0. The general Maclaurin series expansion is as follows:

Below are the trig estimations that we have used in our calculator:







Hardware/Software Tradeoff
     While its hard to maintain sync when using TV, We decided to use the TV as our display to provide a challenge for us to maintain our program to a decent speed and conciseness.
     We decided to use the STK500 board with the 16-MegaHertz mega32 microcontroller chip mostly for two reasons. One is because of the 2K byte onboard memory. This is double the amount of memory provided by mega163 that we have used in the previous labs. This is important because we anticipate our calculator to be using a decent amount of SRAM to store floating point numbers as well as other calculation factors.
     Another reason we use this is for the 16-MegaHertz crystal. This clock speed becomes pertinent to our program in order for us to do large amount of calculation in the software per frame cycle. This speed will greatly help to reduce flicker in the NTSC signals produced to update the TV frame.