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

Back to Subject List

Thread Closed: Issue successfully resolved

???
02/07/04 02:18
Read: times


 
#64142 - RE: Circular buffers
Responding to: ???'s previous message
Peter,

Perhaps your solution is to complicated. Maybe you only need an input pointer and output pointer to a single serial data buffer.

You initialize them to the base of the buffer.

When it is time to see if there is a byte to Transmit to the PC you simply compare the pointers. If they are the same, exit. If they are NOT the same; fetch the byte @ the output pointer, bump the pointer and send the byte to the PC.

You can immediately compare pointers again and transmit next byte or exit.

When a byte is Received, you store it in the buffer @ the input pointer and bump the input pointer. If the input pointer after being "bumped" ever equals the output pointer you are on the verge of overflow and should set a flag to do an immediate transmit routine.

When you bump either pointer you should boundry check to see if you need to re-init to the base of the buffer.

As always you should check your specific scenario once your past "echo testing" to ensure the suitability of the byte by byte buffering. Sometimes message frame buffering is more appropriate for use.

regards,
p


You should also size your buffer against how often you will check for a waiting byte and how much time it takes to transmit to the PC.

This form of circular buffer is simple



List of 35 messages in thread
TopicAuthorDate
Circular buffers            01/01/70 00:00      
   RE: Circular buffers            01/01/70 00:00      
   RE: Circular buffers            01/01/70 00:00      
   RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
   RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
         RE: Circular buffers            01/01/70 00:00      
         RE: Circular buffers            01/01/70 00:00      
            RE: Circular buffers            01/01/70 00:00      
               RE: Circular buffers            01/01/70 00:00      
                  RE: Circular buffers            01/01/70 00:00      
                     RE: Circular buffers            01/01/70 00:00      
                        RE: Circular buffers            01/01/70 00:00      
                           RE: Circular buffers            01/01/70 00:00      
                              RE: Circular buffers            01/01/70 00:00      
                                 RE: Circular buffers            01/01/70 00:00      
                                    RE: Circular buffers            01/01/70 00:00      
               RE: Circular buffers            01/01/70 00:00      
                  RE: Circular buffers            01/01/70 00:00      
                     RE: Circular buffers            01/01/70 00:00      
                        RE: Circular buffers            01/01/70 00:00      
                           RE: Circular buffers            01/01/70 00:00      
                           RE: Circular buffers            01/01/70 00:00      
                              RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
         RE: Circular buffers            01/01/70 00:00      
            RE: Circular buffers            01/01/70 00:00      
   RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
      RE: Circular buffers            01/01/70 00:00      
         RE: Circular buffers            01/01/70 00:00      
            RE: Circular buffers            01/01/70 00:00      
               RE: Circular buffers            01/01/70 00:00      

Back to Subject List