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

MICROCONTROLLER SOFTWARE

The microcontroller software is written in assembly language. There are two modes of operation for the microcontroller. The first is the Data-Gathering mode, and the second is the Upload to Desktop mode. Upload is the default mode for the microcontroller. To gather data, you need to press on the mode switch during powerup. There is an internal resister enabled via the software to keep this input from floating. In the Data-Gathering mode, the software counts the number of revolutions in 1 min. Before a survey, the contents of the EEPROM are set to 0xFF.

The pulses from the Hall effect sensor are stored in the 8-bit timer, or counter. A low-to-high transition on pin 8 of the microcontroller increments the counter. The number of pulses cannot exceed 255 in 1 min., which is nearly impossible. Well, maybe if a really big dog were chasing you.

The 16-bit timer is set up so that an output compare interrupt occurs every 0.5 s. When an interrupt happens, a counter register is incremented by one and the LED blinks.

When 1 min. has passed, the counter reaches 120 and the minute interrupt sets a flag. The main loop waits for the flag to be set, and as soon as that happens, the contents of the 8-bit counter are written to the next location in EEPROM. The contents of the 8-bit timer are then cleared and the cycle repeats for the next minute.

The first minute is written to location zero in the EEPROM, the second minute is at location one, and so on. Because there are 128 bytes of internal EEPROM in the microcontroller, you have 128 min. of data storing capacity (2 h, 8 min.). My bike rides typically last from about 45 to 75 min.

In the Upload mode, the software spits the contents of the EEPROM out the serial port of the microcontroller. The transfer rate is 9600 bps, 8 data bits, no parity, and 1 stop bit. The upload starts with location zero of the EEPROM and ends with location 127. Uploading happens quickly because there is little data transmitted.

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