Content originally posted in LPCWare by Polux rsv on Sun Dec 04 02:54:03 MST 2011
As others said, I also agree using Freertos. Download it on your hd, and create a new project in LPCxpresso using the wizard. It will create a basic example with two tasks. You will understand the principles.
Writing to SD cards is not "time predictible". When data is written to the ram buffer, it is very fast. But when the buffer(s) should be written physicaly on the SD, time is longer(depends on SD brands and type), with some active wait. Data comming from the data acquisition task should be buffered. Whent the SD task finishes the previous write, it reads the buffer to fill the FatFs buffers again.
Receiving from the GPS is also not time predictible. Every 100ms, you receive continously gps frames, which take abot 30-40ms, then nothing during the remaining 60-70ms. You should first configure your GPS to send only the desired frames, usualy the GGA and VTG. This to avoid a lot of precessing time which ends by throwing away the undesired gps sentences.
Angelo