what is Super loop in Embedded systems?
Probably this: en.wikipedia.org/.../Event_loop
I prefer this link: en.wikibooks.org/.../Super_Loop_Architecture
I dislike the term "super loop" as it implies that there is something special about the loop - but there isn't.
It is just an endless loop, and the actions of the system all happen continually within the loop.
Usually, the loop continually checks for events, and takes appropriate action when an event is signalled. The events are detected by code outside the loop - such as interrupt handlers.
Taking the Wikibooks example,
Function Main_Function() { Initialization(); Do_Forever { // The arrival of serial data is recognised in an ISR if( serial data received ) { process serial data } // A keypress might be recognised in an ISR, // or on a timer interrupt, // or by polling, etc if( key pressed ) { respond to key press } // The above processing may have resulted in // something to be displayed if( something to display { update the display } } }
Note that this has nothing specifically to do with embedded systems.
Agreed with the dislike of the name - I have always preferred to refer to it as the supervisor loop since it better indicates that it is carrying out the highest level maintenance function(s).
So, maybe "super loop" is just a shortening of "supervisor loop"...?
It still needs to be understood that there is nothing special or magic (or "super") about the loop itself - it's just a loop.
It's a loop that is "above" ("super") everything else the program does (except one-time init at the beginning).
No, I do not think it is short for supervisor loop.
"Super" is very likely used in the same sense as for superclass/subclass in object-oriented programming.
In this case, it represents the outhermost loop in the program and will call functions that contains small loops that may eat all pending characters from receive buffers etc. The main loop is the superloop and the other loops are subloops.
which is the super loop here...?
for (;;) { for(;;) { for (;;) { } }
The outermost one, but you'd need a supercomputer to actually finish one iteration of it. Everybody knows that supercomputer can iterate through an endless loop in less than 20 minutes. :)
Actually, and old Sinclair Spectrum would be enough to reject that code, since you forgot to supply your superloop with a closing brace ;)
for several decades I have used the name "workloop"
Erik
But what about cases where the loop just sits there twiddling its thumbs most of the time? I would assume that most superloops only do "work" in small fraction of their iterations. ;)
You know, as in
/* One Loop to rule them all, One Loop to find them, One Loop to bring them all and in the darkness bind them */ for(;;) { ... }
StormP once said: "there is nothing like work, I can watch it for hours without getting tired". Also accredited to Will Rogers, I do not know who was the orignal author.
anyhow, is it not work to check a state machine, even if the result is 'idle'
for several decades I have used the name "workloop" here, they call it (probably due to historical reasons!) "main loop".
decades decades! wow.