Thanks for your reply. I am using a 10.000 MHz ceramic resonator with an accuracy of +/- .5% more or less I am trying to figure out how to do timing as accurately as possible. I know there is error because using my delay function I calculate the delay I would need to make an LED blink at 1 Hz...(.5 seconds) using the method I mentioned earlier: 10000000 cycles/sec * 1 inst./4 cycles = 2500000 inst./sec = 2500000 TMR0 Incs/sec 2500000 TMR0 incs/sec * 1 loop/X TMR0 incs = 2 loops/sec X = 1250000 TMR0 incs = 5000 * 250 TMR0 incs = .5 secs/loop here is the code: #include <16f84.h> //================================ #pragma config |= 0x3FFF,WDTE=off,FOSC=HS #pragma bit servo @ PORTA.1 //================================ //do times*cycles TMR0 Increments. void delay(long int times, int cycles) { long int i; for(i = 0;i < times;i++) { TMR0 = 0; while(TMR0 < cycles); } } //============================================================= void main(void) { INTCON = 0x00; OPTION = 0x00; TRISA = 0x00; while(1) //Create a 1 Hz pulse { servo = 0; //Turns LED on (PORTA.1 used to sink current) delay(5000,250); //delays .5 sec sevro = 1; //Turns LED off) delay(5000,250); //delays .5 sec } } //============================================================= I could tell just by looking at the LED that it was not blinking at 1Hz. It was going much more slowly than that, closer to .5 Hz. Tomorrow I will be able to go down to the Electronics lab and use the HP O-Scopes to see exactly what is going on. But somewhere there is considerable error in my ways. The only thing that I can think of is.. that I should not set TMR0 = 0, because by the time I get there a certain about of cycles have already occurred. I would just like to know the best way to solve this problem. Thanks again, Samuel > -----Original Message----- > > First question is what is the accuracy of your resonator? You have >imposed a requirement of 400ppm. >All that aside at the frequency your are running at the time that it takes >to call the function is a very small percentage of the error. >Can you give us more of an explanation, what is the error that you are >observing etc > Sam