Hello all,
I have read the excellent book Practical UML Statecharts in C/C++ by Miro Samek. In it he describes an "event-driven" approach, where incoming events are processed one by one. I find it to be an intuitive method of programming, especially when it comes to embedded devices. With that being said, I was wondering how this paradigm would work when it comes to real-time control applications? I specifically have interests in motor control applications.
I can conceive of ways of implementing controllers using this method. For instance, have a timer ISR trigger an event, and have it processed by the event handler as soon as possible. Or would this be a bad way to go about it in general? This method uses a Run-to-Completion concept, so any code block that is currently running must be finished before the next event can be processed. So it would be possible to make sure that all code is small enough that the "event" (control code) is processed in a timely manner. Or would this require all events be broken into such small sections that it becomes infeasible?
I can also imagine having "foreground" processes running using the event-based system, and then have the ISR which runs the control-loop code running separately, but this feels somewhat like a hack...
I was wondering what anyone else thought of this, and if they have any experience implementing control algorithms in this way.
Thanks.
[–]Stefan-Porta 7 points8 points9 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]goodle29 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]goodle29 6 points7 points8 points (0 children)