Iain Duncan

Project code - advice/tips

Discussion created by Iain Duncan on Feb 3, 2010
Latest reply on Feb 12, 2010 by bigmac



Polar RMCM-01 heart-rate receiver - outputs 1ms, 3V pulse each beat detected

SiRF Starlll EM-406A GPS receiver - spits out NMEA data string (SCI communication)

4D μDrive-USD-G1 μSD card module (SCI communication)


I am currently working on a device (intended for a runner) that will log heart-rate, GPS data, and store on a μSD card. 


I am coding in C, and have some experience of this language and HCS08 μCs, but am not a great programmer. I have found lots of helpful documentation online and also have Fabio Pereira's "HCS08 Unleashed" book, but would appreciate any information or tips that might help me build my code.


Issues such as:

1) How should I set out my code - all in main.c file, or split into the separate sections (how to link    together)?

2) calculate average HR every few pulses from HRr, set up as an interrupt?

3) GPS output @ default frequency 1Hz (as interrupt) or somehow synchronize with HR output?

4) will 2 data types need to be stored to onboard flash or buffer, before being written to μSD, or can I write to it in real time?

5) HR and GPS data must be sychronised in time, can this just be achieved by starting both data logging at same time?

6) end user should have μSD card with 2 files (GPS data and HR data) in .txt format?

7) split data types by simply allocating different memory blocks for each one on μSD card?


Any advice with regards to to above points, ways to code it better, or any general tips on how to tackle the program as a whole would be greatly appreciated.