Overall System Management Software

advertisement
Overall System Management Software
The software is divided into three big categories: Menu System, Start Run, and
Read Run.
Menu System:
The menu system layout is designed with a three button input in mind. With three
buttons, many different options were considered for purpose of each button. In the end, it
was decided to make two buttons navigation of choices, and the third selection of choice.
This allows for a theoretical infinite choice system.
The menu system was design future expansion in mind. It is a large case
statement which switches what output is shown on the LCD, and changes your available
choices for menu switching. It is simple to add new menus, and new menu options to the
design. The reason for this design decision is to allow for flexibility in designing our
product.
Figure: Example Menu
“In Main Menu: Go To Start Run”
Start Run
The Start Run option is centered on saving data to EEPROM and timed readings
of the ADC. It polls the ADC every 2 seconds to get current speed from the Doppler
module. It sums and averages these values every 10 seconds to find the average speed
over 10 second periods. It then stores these values into the EEPROM. This method was
chosen because using internal local variables to hold the sum of all velocities over the run
would result in an overflow of the local variable, therefore skewing all information
derived from the data.
The polling of the ADC stops when two zero velocities are detected in a row. This
prevents exiting on a single false positive of a zero speed. After the polling of the ADC
stops, the calculation/reduction phase begins. The data of averaged velocities over the run
is iterated through. From it, we detect for maximum speed and find the total average
speed. We store these variables into the EEPROM as Run Data. We also store the number
of data points plotted, which will be used to calculate time. The last thing we store is the
number of polls done to the ADC prior to exiting. This will also be used to give us a more
accurate time, because using just the number of data points will give us the nearest 10
second mark. After finishing this phase, the run data has been analyzed and reduced to
critical components, then stored into a permanent location. All of this information is an
extremely modest six bytes.
Read Run
The last category is Reading the Run Data. This is done both at the end of a run,
and when the user requests such data. The method for retrieving the data is to simply get
the address in EEPROM based on which run is chosen. Then the six bytes of runs data
are pulled and used to do calculations. The average speed and max speed are converted
from their digital voltage value to their actual speed in miles per hour. The time is a
calculation using the number of data points and the number of polls to the ADC. It is
accurate to the nearest two seconds. The distance is calculated from the Average Speed
and Time. These are then output to the LCD screen for the user to read.
Download