ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

MONITORING THE REVOLUTIONS


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

MONITORING THE REVOLUTIONS

Lessons from the Trenches A Pedal Cadence Counter
by Matt Meerian

Start ý The Hardware ý Microcontroller Software ý Desktop Software ý Placement ý Happy Trails ý Sources and PDF

DESKTOP SOFTWARE

The Visual Basic software uploads data from the microcontroller and displays a simple graph. Photo 1 shows a screenshot of the graph.

Photo 1ýHere's the Visual Basic software in action. The number of revolutions per minute is shown on the y axis. The x axis shows the time in minutes. (click to enlarge)

 

Because there are few functions taking place, I opted for simplicity by not having any pull-down menus. The total number of revolutions is shown when a file is opened from disk.

Serial communications are simple in Visual Basic. When the serial buffer gets full, an OnComm event fires. The data is then taken out of the serial buffer and placed in a string. When the OnComm event is first executed, a timer closes the Comm port after 2 s. Two seconds is more than enough time to upload data from the microcontroller. The serial buffer string in the desktop is processed one character at a time.

The Save button stores whatever is in the text box. The file name consists of the year, month, day, and hour the file was uploaded. The default extension for a saved file is .rev. The explorer box looks for a .rev file when opening a file.

If desired, the name of the file can be changed to include the path taken or mileage from the odometer, if you have one. The raw data file can be seen in the left-hand text box. The text box has the locked property set to true, so the text can be viewed but not be changed.

Pressing the Open button brings up an explorer-type box, which can be used to open a .rev file. When the data is being graphed, vertical gray lines erase any previous graph that was displayed. Gray lines are also painted over the graph before an upload.

The file format for a .rev file is:

minute 1, revolution count
minute 2, revolution count
ý

The first couple of lines of an example file are shown as:

1,56
2,64
3,34
4,65
ý

The microcontroller sends a carriage return and life feed at the end of each line of text.

The data is uploaded in binary mode and converted to ASCII characters by the Visual Basic software. Note that after a file is uploaded, you must press Save to store the data on the hard drive. The file name of the saved file is shown in the title bar.

The data is stored in a comma-delimited format, which can be easily opened in a spreadsheet program, such as Excel, to create customized graphs. Visual Basic also can be used to create new graphs, of course.

PREVIOUS ý NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ