Looking at another style of program structure,
I'd like to create a program that works through a sequence of events but does not stall/delay whilst waiting for external events and executes these tasks at a reasonably consistent rate,
A very simple example project might have the following tasks,
Sampling 4 external inputs at roughly 20Hz each.
Transmit a CAN message at 10Hz
Update of LCD values at 2 Hz
Update all of the other calculations as fast as possible.
I guess this is basically looking for a tidy and flexible way to use a timer based interrupt, just not sure how to implement this.
I understand setting up an interrupt to roll over at a specific frequency and use this to index a counter or something but how do I trigger these events from the counter? Use a sequence of IF statements ?
I also can see that you need some headroom in processor capacity to enable each task to be completed, before then next task has to run.
Any good stripped down examples?

Thanks,
J.