Professional Documents
Culture Documents
B.Bachmann, S. Grob
States:
State 1: Gather/Store Data
When the user enters a number on the keypad for the 1 st time, the number is stored as 0 times
10 times the value of the key pressed. This number is then stored and utilized again in place of the 0 in
the following calculations until the user has completed entering the 1 st number indicated by the pressing
of an operation or the enter key, entering State 2 or 3 respectively.
1+10+100+1000
=1111
As Shown through Figure 2, the values of the different numbers are stored as described above.
State 2: Operation
When the user presses an operation key +/-, the operation is stored, and State 1 is entered.
1-2
=-2
Utilizes the stored math type to print the result of the desired operation to the LCD.
1+1
=2
Utilized Functions
WriteCharacterToLCD(unsigned char character)
ClearLCD(void)
BackspaceLCD(void)
Moves the cursor back, prints a blank character, and then moves the cursor forward again
11+20+30 11+20+3_
11+20+3
=34
Performs the desired operation on the 2 entered numbers: op = 0 for addition and op = 1 for
subtraction.
WriteIntToLCD(int64_t temp_num)
Finds the length of the number, converts the integer into an array, and then prints out each
integer within that array one at a time using WriteCharacterToLCD(unsigned char character).
WriteToRightSide(int64_t temp_num)
Finds the length of the integer, moves cursor to the right far enough to fit the integer, then
prints the resultant integer.