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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/27/04 10:18
Read: times


 
#83918 - Interrupt latency calculation
Hi

I want to know how to calculate interrupt latency in a timer event. I am using Keil C++ compiler and using AT89c52 chip.

I am generating 50ms interrupt and in every interrupt i increment a variable and when it reaches 20 that means i second has passed so i increment another variable seconds. then i reload the timer register for 50 milliseconds and get out of interrupt routine.

i know that this routine in interrupt is taking time and i am not considering this time in interrupt. so i think after some time my timer in 8052 will be behind the clock.


what i need to know is the number of clock cycles that is taking my routine in interrupt and subtract it from the 50ms number i am loading in timer register.


i just want to know how to calculate how many time is talking place in the C function below.


also what other processing is taking time during interrupt like jumping to interrupt routine and coming back to original point of execution.



Shahzad Aslam




void Timerinterrupt(void)
{
TR0 = 0 //stop timer

z++;
if(z == 20)
{
z = 0;
seconds++;
}

//here i reload the TH0 and TL0 value for 50 millseconds. don't rememeber the value right now

TH0 = <>
TL0 = <>


TR0 = 1; //start running timer
}

List of 11 messages in thread
TopicAuthorDate
Interrupt latency calculation            01/01/70 00:00      
   Constant = variable            01/01/70 00:00      
      Yes that's correct            01/01/70 00:00      
         16-bit auto-reload            01/01/70 00:00      
   Performance Analyzer            01/01/70 00:00      
   Accuracy, thats the question            01/01/70 00:00      
      accuracy            01/01/70 00:00      
   A bad order            01/01/70 00:00      
   another alternative            01/01/70 00:00      
      correction Timer2 not Timer1            01/01/70 00:00      
         Timer2            01/01/70 00:00      

Back to Subject List