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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/19/06 16:34
Read: times


 
#124586 - Fixing Problems vs. Hiding Them
Responding to: ???'s previous message
Russ, that is basically what's happening. My hope with the interrupt routine was that I could get the characters one at a time, be able to check certain values in the buffer I place them in, validate the string using the incoming checksum, and a few other things. But this way if I suddenly didn't get another byte when I'm wanting one, I could send a NAK to the other device and try the whole thing again. This would (hopefully) keep me from just getting stuck in a loop waiting for a byte that's never going to come. Does seem seem like the way to go?


That seems reasonable. The interrupt routine puts characters in the buffer as they arrive, and the mainline code pulls the plug and sends a NAK if it ever times out waiting for a character.

Just one caution, however. Timeouts and checksums and retries and the like are appropriate where you are dealing with something like an unreliable communications channel, where noise and dropped characters and so on are to be expected and must be handled gracefully.

In other situations, however, the system should be (more or less) 100% reliable and any errors that you do see should be taken as indications of some problem that you can fix at the source. In cases like this, timeouts and checksums and retries just cover it up the symptoms without really solving the problem, and you're way better off trying to find the root cause of the errors. If you don't, you may find yourself applying patch after patch after patch as various symptoms of the underlying problem expose themselves one by one.

So in your case you have to ask yourself why you are not getting all the characters you expect. If you know the answer and can justify it as acceptable, then go ahead with the timeouts and checksums and retries. Otherwise, spend some time trying to understand why you're not getting the characters you expect.

-- Russ


List of 56 messages in thread
TopicAuthorDate
Variables within ISR            01/01/70 00:00      
   static            01/01/70 00:00      
      Static, link            01/01/70 00:00      
   beware            01/01/70 00:00      
      Modular Programming            01/01/70 00:00      
         a rebuttal            01/01/70 00:00      
            A Faq about...            01/01/70 00:00      
            Global variables            01/01/70 00:00      
               "Self Documenting"            01/01/70 00:00      
            Global Variables Compromise Modularity            01/01/70 00:00      
               Module vs Global scope            01/01/70 00:00      
               file static            01/01/70 00:00      
                  RE: file static            01/01/70 00:00      
                     extern does matter            01/01/70 00:00      
                  Undeclared Variables            01/01/70 00:00      
                     to Russ            01/01/70 00:00      
                     try this            01/01/70 00:00      
                        Re: try this            01/01/70 00:00      
               Not Evil            01/01/70 00:00      
               module variables            01/01/70 00:00      
                  yes and no all must be weighed            01/01/70 00:00      
         Hmm            01/01/70 00:00      
            the advantages of not suffering from interruptifob            01/01/70 00:00      
            That is the typical way            01/01/70 00:00      
               yes, absolutely            01/01/70 00:00      
                  Depends on the use            01/01/70 00:00      
                     every rule can (and should) be broken            01/01/70 00:00      
            Fixing Problems vs. Hiding Them            01/01/70 00:00      
               I agree, but many take this as an excuse            01/01/70 00:00      
                  Be Defensive            01/01/70 00:00      
   A Module Example            01/01/70 00:00      
      if we are to give examples            01/01/70 00:00      
         Poor example            01/01/70 00:00      
            not so poor            01/01/70 00:00      
         Reasons to Waste Machine Cycles            01/01/70 00:00      
            it is still 'hidden' and BTW why hide it            01/01/70 00:00      
               I'm Done Preaching            01/01/70 00:00      
                  I hope that as well            01/01/70 00:00      
         to asm programmers..            01/01/70 00:00      
            Poor Logic            01/01/70 00:00      
               what an utterly stupid teacher            01/01/70 00:00      
                  OO            01/01/70 00:00      
                     No            01/01/70 00:00      
                     What OOP tells you            01/01/70 00:00      
                        A long Time ago            01/01/70 00:00      
                  I disagree            01/01/70 00:00      
                     some of the worst 'spaghetti' I have seen            01/01/70 00:00      
               Rules in C            01/01/70 00:00      
                  rules imposed on C            01/01/70 00:00      
                     Language Problems            01/01/70 00:00      
            that is very relevant            01/01/70 00:00      
         what about the library?            01/01/70 00:00      
            OH NO            01/01/70 00:00      
               Experience is the best teacher            01/01/70 00:00      
                  overlay            01/01/70 00:00      
                  to Russell            01/01/70 00:00      

Back to Subject List