Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/08 21:33
Read: times


 
#157307 - Never underestimate the usefulnes of interrupts
Responding to: ???'s previous message
Erik Malund said:
I have, in a few cases, implemented 'multitasking' by setting all 'regular' interrupts to prt1 and having an otherwise unused ISR at priority 0 running "the priority task"


One example of my "creative" use of interrupts.

With good planning, a lot can be performed at interrupt time, without consuming too much time or affecting the interrupt response times.

A receive interrupt need not limit itself to just taking a character and put in a receive buffer. It can also process SOM/EOM bytes and compute a running checksum. Then, the main program don't need to spend time checking if there are received bytes, but can check if there are received packets.

Large number of times can be handled by a sorted priority queue, in which case the application need not loop through a large number of timers to see if anything needs to do. The timer interrupt can decrement the head of the prio queue, and set a flag if timeout. That gives a constant time in the ISR - for any number of timers - while the main loop can wait with deciding "what" needs to be done until it sees the flag that "anything" needs to be done.

With a bit of work, very complex applications can be written using a super-loop, without making the application impossible to maintain. The hard part - but it is always hard - is to prove a worst-case response time for any combination if timeouts and input stimuli.




List of 27 messages in thread
TopicAuthorDate
Non Blocking timer            01/01/70 00:00      
   Use a hardware timer            01/01/70 00:00      
      Thanks - But.....            01/01/70 00:00      
         State machines            01/01/70 00:00      
            THANKS - That's a great idea            01/01/70 00:00      
               if you have a lot to delay by various delays            01/01/70 00:00      
                  I Like that Idea as well            01/01/70 00:00      
                  A Linked List might be better here            01/01/70 00:00      
                     the correct use takes care of this            01/01/70 00:00      
                        Not necessarily            01/01/70 00:00      
   Cooperative or preemptive multitasking            01/01/70 00:00      
      Super-loop contra cooperative multitasking            01/01/70 00:00      
         Multasking can work on the 8051 ... sometimes            01/01/70 00:00      
            Not just stack            01/01/70 00:00      
               I agree            01/01/70 00:00      
                  Choose your battles carefully            01/01/70 00:00      
               I agree, too            01/01/70 00:00      
                  and            01/01/70 00:00      
                     Never underestimate the usefulnes of interrupts            01/01/70 00:00      
                        a flavor            01/01/70 00:00      
                           prioritizing in super-loop            01/01/70 00:00      
                              the fact is ..            01/01/70 00:00      
                  C works well            01/01/70 00:00      
                  Circular argument?            01/01/70 00:00      
                     Re: Circular Argument            01/01/70 00:00      
                        going round in circles            01/01/70 00:00      
            small multitasker            01/01/70 00:00      

Back to Subject List