|
Re: Interrupt timer, executing code asap?
Real time programming requires the use of a "state machine", which is a programming technique where one state starts the motors, for example, and the second state monitors for a certain amount of time to pass before proceeding to the third state.
The second state can be entered multiple times without causing any problems. So the second state checks the time, then reutrns to the code where the data packets can be handled. Then the same fuction is called to execute the seconds state which looks at the time again.
State machines are best implemented using the C "switch" statement, and some long hard thinking.
|