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

Back to Subject List

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


 
#83399 - Timer interrupt in KEIL
Hi

To my best i could not capture a timer interrupt in KEIL. I want to program Timer 2 so that it trigger a interrupt after say 100 or 50 milliseconds. I have a variable named Seconds which will record the time elapsed since the system goes On Power. (system will stay ON for infinite number of days and i have to keep track how many days were gone since the system was turn ON.) For this purpose i design a routine so that a variable will increment after every 1 second. so when i need days... i simply conver seconds in days.(or even get the Date and Time i know the algorithim)

Now the real problme is how to program timer 2 to be interrupted after say 100 millseconds.(i will write the code so that variable get incremented after 1 second).

Here is the simple function

void SomeFunction()
{
Some100MillisecondVariable = Some100MillisecondVariable + 1
}


and i want this function to be called after every 100 milliseconds.


In keil there are interrupts and that is what i want to capture.
Please send me a sample code to experiment with.


Also let me know how to handle Timer errors... as after a long time.. system time will get out of sync with actual time. as there is always some processing time when interrupt is called and executed and return. this time is not covered and after a long period of time this will become a significantly large. how to avode this.

I am using KEIL C.
I am using crystal frequency of 11.<sorry forget the fractional number>


Shahzad Aslam

List of 8 messages in thread
TopicAuthorDate
Timer interrupt in KEIL            01/01/70 00:00      
   RTFM!            01/01/70 00:00      
      ... and the Tutorials            01/01/70 00:00      
   two ways            01/01/70 00:00      
      A Third Way            01/01/70 00:00      
   Code for accurate 1 sec            01/01/70 00:00      
      Re Raghunathan            01/01/70 00:00      
         Thank Peter...            01/01/70 00:00      

Back to Subject List