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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/31/10 13:03
Read: times


 
#174672 - google academy
Responding to: ???'s previous message
You let the main application process lines one at a time.

It really should not be hard for the main application to keep track of the state - is it processing a line that is an echo of the transmitted command, or is it processing a line representing a result.

When having interrupt handler, you don't want to move data in your buffer unless you are using dual-buffering.

The concept of a round-robin ring buffer is that one side (the interrupt) owns one side of the buffer (either read or write) and the main loop owns the other side.

That means that the interrupt routine updates the insert position when it receives data, and the main loop updates the read-out position as it consumes data.
For outgoing, the main loop updates the insert position, and the interrupt handler updates the read-out position.

Why is this important? It makes sure that two "threads" can play nicely without need for synchronization.

So either let your main loop pick up characters one-by-one to drive your state machine.

Or pick up characters one-by-one and move to a "line" buffer.

But no move of data within the ring buffer, for situations where two different "threads" handles produce and consume.

List of 33 messages in thread
TopicAuthorDate
GSM Module Testing            01/01/70 00:00      
   9-wire VS 3-wire            01/01/70 00:00      
   Don't guess!            01/01/70 00:00      
   I will            01/01/70 00:00      
      missed the point            01/01/70 00:00      
      probably the commonest beginner's mistake with AT commands            01/01/70 00:00      
         ohhhkie            01/01/70 00:00      
   it is working, BUT !            01/01/70 00:00      
      Look at string manipulation on other targets - almost same            01/01/70 00:00      
         which other targets,            01/01/70 00:00      
            RE: printf            01/01/70 00:00      
               sorry            01/01/70 00:00      
                  Do you need generic formatting?            01/01/70 00:00      
                     HANG            01/01/70 00:00      
                        RTFM            01/01/70 00:00      
                     puts, itoa            01/01/70 00:00      
                        itoa() isn't generally available            01/01/70 00:00      
                           None of which            01/01/70 00:00      
                     If you do need generic formatting...            01/01/70 00:00      
                  Any 'C' textbook...            01/01/70 00:00      
   how to read a reply ??            01/01/70 00:00      
      CRLF - and V.250            01/01/70 00:00      
      carriage return and line feed            01/01/70 00:00      
      CR n LF            01/01/70 00:00      
         A State Machine...            01/01/70 00:00      
            Dear Andy            01/01/70 00:00      
               google academy            01/01/70 00:00      
               Oh, come on!            01/01/70 00:00      
                  State Machines are easy...            01/01/70 00:00      
                     IAR Article on State MachineDesign            01/01/70 00:00      
               Thanks            01/01/70 00:00      
                  Another keyword you might try...            01/01/70 00:00      
   It is working !!            01/01/70 00:00      

Back to Subject List