View Single Post
Old 06-04-2009, 03:16 AM   #1534 (permalink)
EcoModding Apprentice
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 1 Time in 1 Post
Simple concepts to ponder

A good rule is to keep ISRs as short as possible, minimises the risk of interrupting interrupt routines.

By now you should be able to gauge the approximate cycle time of your main loop (I guess you already have) so you can build you process priority list.

I will try and describe a concept I like to use to 'balance' the process load. Use a counter to count the number of main loop operations (ie a cyclic counter 0..15,0..15,..) Highest priority stuff might get processed in every loop, however you might find there are four processes you want to run once every 8th cycle. So one gets processed in loop 2 & 10, another is processed in 4 & this making sense. Ultimate aim is to keep the maximum cycle time as short as possible.

Of course you could have a main loop that actually does nothing, and just run everything from a timer interrupt....but that takes a whole lot of planning.

My apologies if you have already considered all these issues, not intending to waste your time.
  Reply With Quote