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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/15/04 10:37
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#77430 - RE: Priority interrupt problem with DS5240
Responding to: ???'s previous message

A couple of guesses here:

Declare your vars in the interrupt as 'static'. This might fix your problem directly. 'Static' allocates memory for the variable rather than using the variable pool.

The other item which I doubt is causing your problem is when you reload the timer do it as soon as possible in your isr - this is so you don't introduce variable times due to the different execution time of your code - The timer can't re-interrupt since you have yet to do a RETI.

#define TIMER_RELOAD 0xfffd //set timer for 10mS

//Timer 0 Interrupt manages a virtual timer table
void timer0 (void) interrupt 1 using 3
{
static data unsigned char *ptabella;
static data unsigned char i;

TR0 = 0;
//TL0 = (unsigned char)LO_T0;
//TH0 = (unsigned char)HI_T0;
TL0 = TIMER_RELOAD & 0x00ff;
TH0 = TIMER_RELOAD >> 8; //a slightly different of handling the constant!
TR0 = 1;

ptabella = (unsigned char data*) &timer10ms;
for( i = 0; i < LENTIMER10MS; i++ )
{
if( (*ptabella) !=0 )
(*ptabella)--;

ptabella++;
}

if( --prescaler_50ms == 0 )
{
prescaler_50ms = VALUE_50MS;
ptabella = (unsigned char data*)&timer50ms;

for( i = 0; i < LENTIMER50MS; i++ )
{
if( (*ptabella) !=0 )
(*ptabella)--;

ptabella++;
}

if( --prescaler_1sec == 0 )
{
prescaler_1sec = VALUE_1SEC;
ptabella =(unsigned char data*)&timer1sec;
for( i = 0; i < LENTIMER1SEC; i++ )
{
if( (*ptabella) !=0 )
{
(*ptabella) --;
}
ptabella++;
}

}

}
}



List of 43 messages in thread
TopicAuthorDate
Priority interrupt problem with DS5240            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS5240            01/01/70 00:00      
         RE: Priority interrupt problem with DS5240            01/01/70 00:00      
            RE: Priority interrupt problem with DS5240            01/01/70 00:00      
            RE: Priority interrupt problem with DS5240            01/01/70 00:00      
   just a thought            01/01/70 00:00      
      RE: just a thought            01/01/70 00:00      
         RE: just a thought            01/01/70 00:00      
            RE: just a thought            01/01/70 00:00      
               RE: just a thought            01/01/70 00:00      
                  RE: just a thought            01/01/70 00:00      
                     RE: just a thought            01/01/70 00:00      
                        RE: just a thought            01/01/70 00:00      
                           RE: just a thought            01/01/70 00:00      
                  RE: just a thought            01/01/70 00:00      
   Avoid USING !            01/01/70 00:00      
      RE: Avoid USING !            01/01/70 00:00      
         caught it myseld            01/01/70 00:00      
      RE: Avoid USING !            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS52            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      Get rid of USING            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      use using ???            01/01/70 00:00      
   Resolved?            01/01/70 00:00      
   My USING experience            01/01/70 00:00      
      RE: My USING experience            01/01/70 00:00      
         Resolved ? ... I don\'t know            01/01/70 00:00      
   !! PROBLEM SOLVED!!!!            01/01/70 00:00      
      Which compiler?            01/01/70 00:00      
         RE: Which compiler?            01/01/70 00:00      
      RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
         RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
            RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
      RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
         RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
            RE: !! PROBLEM SOLVED!!!!            01/01/70 00:00      
   RE: Priority interrupt problem with DS5240            01/01/70 00:00      
      RE: Priority interrupt problem with DS5240            01/01/70 00:00      
         RE: Priority interrupt problem with DS5240            01/01/70 00:00      

Back to Subject List