Hello again, I guess I will be well known to this list because of my multiple questions addressed to you. I have now over 1 year experience with PIC's, but still have a lot of questions... This one regards a simple issue (as it is the case with many of my questions): I am trying to make a routine to keep count of the seconds. I have a 20MHz PIC, and need one second period. I use Timer0, with no prescaler and have inspired myself after the "zero-error" procedure of Roman Black. My code is the following: if (T0IF) { if (bres_mid == 0) { bres_hi--; //some counters - is there a problem with them here ? if (!(serialcount--)) serialflag=1; if (txcount) txcount--; if (waitcount) waitcount--; } ///////////////////////////////// bres_mid--; if (bres_mid == 0 && bres_hi == 0) { //one second has passed bres_hi = BRES_HI; bres_mid = BRES_MID; bres_lo += BRES_LO; #asm btfsc _STATUS, 0 incf _bres_mid #endasm //code executed each second - incrementing some time registers } } Now, my time period is bigger than 1 second as in 10 minutes, it delays about 20 seconds. Where is the problem ? With the code in (bres_mid == 0) or is the code after the second period too large ? The counters in (bres_mid == 0) are for some routines needing a period smaller than one second... I'm sorry if this seems too simple for you, but I'm trying to understand what is wrong here. Thank you ! Lucian -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body