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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/29/11 11:01
Read: times


 
#184420 - Multiple calls to segment
While compiling 8951f340 program in Keil, it warns about multiple calls to segment. The calls are made to delay routine. Delay routine is not re-entrant. Delay routines are called from Timer and Serial port ISR. The possibility of the reentering the routine is minimal, but it does happen. This project code was written by one of the newly joined guy.

Please find the delay routine below.

void wait_10ms(unsigned int count)
{
PCA0CPH4 = 0x00; //WDT
for (count; count>0;count--)
wait_1ms(10);
}
void wait_1ms(unsigned int count1)
{
PCA0CPH4 = 0x00;
for (count1;count1>0; count1--)
wait_1us(1000);
}

void wait_1us(unsigned int count2)
{
PCA0CPH4 = 0x00; // WDT reset
for(count2;count2>0;count2--)
_nop_(); // gives 1us sec approx
}

1. If the routine gets reentered, it can cause the wrong delays, but is there a possibility that stack overflow causing the program to hang? (Program seems to be hanging after 4 days of operation)

2. Instead of having 3 functions, if the function is reduced to a single function, it would be minimize the damage, right?

4. Should the function be defined as re-entrant? Or should the function be duplicated so that ISRs call different routines for delay? The possibility of one ISR calling the routine multiple times causing re-entering seems to be NIL.

Kindly comment.

Regards, Raj

List of 9 messages in thread
TopicAuthorDate
Multiple calls to segment            01/01/70 00:00      
   General ISR Design Principle            01/01/70 00:00      
      Incorrect use of ISR            01/01/70 00:00      
         the missed issue            01/01/70 00:00      
      Delay Routines....            01/01/70 00:00      
         Thanks a million...            01/01/70 00:00      
            us, not ms            01/01/70 00:00      
      try this - maybe            01/01/70 00:00      
         Thanks Brown..            01/01/70 00:00      

Back to Subject List