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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/09/05 12:37
Read: times


 
#100859 - I just had to fix something in a system
I just had to fix something in a system using the '51 and I would like to share the root cause and its remedies (the case was not related to RI, but RI serves well as a universally understandable example):

This applies many places and many ways, I just show one example

if you are an ISRfobic and code the following in the main
while (!RI);
Ralph = SBUF;
....
you are, in effect, guaranteeing that your system will hang on occasion.
I have seen this in code dealing with motors and who knows what those motors will do when the system is hung.

If you absolutotally have to do it that way, at least do
either
workloop:
....
if (RI) // we know the loop will come around
{
  Ralph = SBUF;
}

or

for (Billy = big_number; Billy!=0; Billy--)
{
  if (RI) break;
}
if (RI) // timeout or data ?
{
  Ralph = SBUF;
}
I often have the unfortunate "pleasure" of seeing code that is based on everything just humming along, and, invariably, I have to add measures to handle when that is not the case.

SO, do your code based on everything from the outside possihly (not) happening and you will save yourself a future embarassment.

Erik

List of 9 messages in thread
TopicAuthorDate
I just had to fix something in a system            01/01/70 00:00      
   90:10 Rule            01/01/70 00:00      
      code like this is where we hear "the cod            01/01/70 00:00      
   Testing            01/01/70 00:00      
      A common 'gotcha'            01/01/70 00:00      
         Design document            01/01/70 00:00      
            What is magic document you speak of?            01/01/70 00:00      
               Ask            01/01/70 00:00      
         Normal            01/01/70 00:00      

Back to Subject List