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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/08/05 00:53
Read: times


 
#91231 - Synchonocity was the issue
Responding to: ???'s previous message
Hello Erik,

Yes. You spotted the problem bang on. The following corrections to the delay routine and T2 ISR, in line with your suggestions solved the problem. The timing is perfect now.
//=============================================
// T2 is set for a 1ms interrupt in auto-reload

void timer2_int(void) interrupt 5 using 2
{
  TF2 = 0;
 
  ++checkCount;
  --msTick_1 ;        // Initialized by msDelay function

  if ( msTick_1==0 )
   {
    DelayOver = 1;   // to flag that the delay has timed out
   }
} 
//==============================================
//Time delay function. Call with required ms delay

 void msDelay (int DelayVal)
{
  msTick_1 = DelayVal;
  DelayOver = 0;
  TR2 = 1;
  while ( !DelayOver ); // Wait for timed out flag from T2 ISR
  msTick_1 = 0;
  TR2 = 0;
} 
//===============================================


Thanks a lot.

Raghu

List of 7 messages in thread
TopicAuthorDate
A timing issue            01/01/70 00:00      
   Atomicity?            01/01/70 00:00      
   curious            01/01/70 00:00      
      Synchonocity was the issue            01/01/70 00:00      
      Synchonocity and Atmomicity?            01/01/70 00:00      
         Let me try?            01/01/70 00:00      
            Atomic and Synchronous            01/01/70 00:00      

Back to Subject List