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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/27/07 03:07
Read: times


 
#148759 - and some more reasons to use (circular) buffers
Responding to: ???'s previous message
(Circular) buffers are architecturally beautiful.
This is because when interrupts are used the main program and the interrupt code are manipulating different parts of this shared resource. It is possible to code the buffer in a way that interrupts can be left running while checking the buffer contents. This of course assuming that the buffer pointers are one byte wide thus making their read and write an atomic operation.

(Circular) buffers make Your code more reliable.
A general rule of thumb in embedded coding is that one should keep the hands off the hardware unless really needed to fiddle with it. The ring buffers are memory elements - not hardware so polling of those does not have any unwanted side effects. Further more, the hardware access occurs ONLY as needed.

(Circular) buffers allow more readable programming
As Your design is freed from strict timing limitations of direct data port access You can design Your software with more freedom. This should lead into more readable and architecturally beautiful result. Although coding is not the beauty-contest it is not a bad idea to put some effort on standardising the code.

List of 34 messages in thread
TopicAuthorDate
Having problem on using interrupt            01/01/70 00:00      
   Answers            01/01/70 00:00      
      not so fast, Cristoph and to Ragu            01/01/70 00:00      
         Serial comm is slow.            01/01/70 00:00      
            if you read the OP            01/01/70 00:00      
               good interupts            01/01/70 00:00      
                  AAAAAARGH            01/01/70 00:00      
                     not AAAAAAAARGH            01/01/70 00:00      
                        OH YES            01/01/70 00:00      
                           do You ever avoid "non-debuggable"?            01/01/70 00:00      
                              always            01/01/70 00:00      
                                 nice            01/01/70 00:00      
                                    a trick for "long ISRs" better than a RTOS            01/01/70 00:00      
         Buffered RX            01/01/70 00:00      
            not much difference            01/01/70 00:00      
               You are right            01/01/70 00:00      
   Sucess with interrupts            01/01/70 00:00      
      Isn't it too short?            01/01/70 00:00      
         the reason for circular buffers            01/01/70 00:00      
            Worst case, instead of average            01/01/70 00:00      
               absolutely, just worst case is not as bad            01/01/70 00:00      
                  single, double and ring buffer            01/01/70 00:00      
                     single, double and ring buffer app dependent            01/01/70 00:00      
         and some more reasons to use (circular) buffers            01/01/70 00:00      
            buffer overflow error            01/01/70 00:00      
               Buffer overflow handling            01/01/70 00:00      
                  Buffering options            01/01/70 00:00      
                     Beauty contest !            01/01/70 00:00      
                        flexible is the best?            01/01/70 00:00      
                        Simplicity is always better            01/01/70 00:00      
                           simple is another word for            01/01/70 00:00      
                              Where is the borderline to stumble on            01/01/70 00:00      
                                 Copper Oxide            01/01/70 00:00      
               please exclude me from the 'we'            01/01/70 00:00      

Back to Subject List