Hi all,
I'm still playing with my current project and getting to grips with some of the GHOST features....however I need to give my base program a better structure.
Does anyone have a good simple example of a program structure where, I can schedule tasks?
I'm thinking of a some tasks that run for every time, some every other time, some every 5 and others every 10...etc..
This way I can priorities small or high speed task like checking for alarm conditions, scanning for key presses, closed loop monitoring....and run other less critical tasks like diagnostic output to a terminal at a slower rate.
I'm trying to avoid using a timer (unless thats the best solution) as some task may well last longer than the interupt period.
thoughts? J.
Program structure, Task Scheduler or Sequence
Moderator: Benj
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: Program structure, Task Scheduler or Sequence
Hi
Without knowing your application it is difficult to suggest the best approach. However I have leaned towards "state machines" in recent times (thanks Benj). Basically the program loops around a basic task, branching off when a certain condition is reached before either branching further or returning to initial loop.
I probably haven't explained it very well but here is a link to the wiki https://www.matrixtsl.com/wikiv7/index. ... ateMachine
I have used these in applications where a basic housekeeping/supervisory function runs, branching off depending on interrupt / timer / keypress etc and there are many examples in the forum
Hope this may help.
Regards
Without knowing your application it is difficult to suggest the best approach. However I have leaned towards "state machines" in recent times (thanks Benj). Basically the program loops around a basic task, branching off when a certain condition is reached before either branching further or returning to initial loop.
I probably haven't explained it very well but here is a link to the wiki https://www.matrixtsl.com/wikiv7/index. ... ateMachine
I have used these in applications where a basic housekeeping/supervisory function runs, branching off depending on interrupt / timer / keypress etc and there are many examples in the forum
Hope this may help.
Regards