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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Raj Nambiar
10/29/11 05:01
Read: 817 times
Dubai
Uae


 
#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      Raj Nambiar      10/29/11 05:01      
   General ISR Design Principle        Michael Karas      10/29/11 06:14      
      Incorrect use of ISR      Per Westermark      10/29/11 07:06      
         the missed issue      Erik Malund      10/29/11 08:07      
      Delay Routines....      Michael Karas      10/29/11 09:34      
         Thanks a million...      Raj Nambiar      10/31/11 02:07      
            us, not ms      Per Westermark      10/31/11 04:27      
      try this - maybe      Marshall Brown      10/31/11 04:14      
         Thanks Brown..      Raj Nambiar      11/04/11 09:44      

Back to Subject List