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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/13/04 19:47
Read: times


 
#62480 - Creating a 1 second timebase
Hello

I have a Philips 80c552 running at 22.1184 MHz and I am trying out an interrupt handler for timer 0 overflow. The body of the interrupt handler goes something like this:

TR0 = 0;
TH0 = 0x4c;
TL0 = 0x00;
TR0 = 1;
if (!counter) {
counter = 40;
official_time++;
}

I have tested this and it works, however I know that it is not as accurate as possible. The variable official_time is an unsigned long that will hold the number of seconds elapsed. Presetting timer 0 with 0x4c00 (19456), and then watching for every fortieth timer 0 interrupt, should give approximately a one second interval. My question is, should 0x4c00 be decremented by the time it takes to execute the first four lines of code above? Or should I not include the time that the first line takes? I'd like to get it as accurate as possible.

thanks

List of 9 messages in thread
TopicAuthorDate
Creating a 1 second timebase            01/01/70 00:00      
   RE: Creating a 1 second timebase            01/01/70 00:00      
   RE: Creating a 1 second timebase            01/01/70 00:00      
   RE: Creating a 1 second timebase            01/01/70 00:00      
      I've read the tutorials, the spec sheets            01/01/70 00:00      
         RE: I've read the tutorials, the spec sheets            01/01/70 00:00      
            RE: I've read the tutorials, the spec sheets            01/01/70 00:00      
   RE: Creating a 1 second timebase            01/01/70 00:00      
      RE: Creating a 1 second timebase            01/01/70 00:00      

Back to Subject List