On Wed, 6 Aug 2003, Samo Benedicic wrote: > I think ten or so days ago someone posted code > fragment that deals with this 1 cycle jitter issue. I must've missed it among the flurry of rediculously off topic posts we've had lately. (What's the deal with asking questions about Excel on a microcontroller mailing list? My question is rhetorical *please* don't waste time answering it!) But back on topic.... Was it something like this: ; interrupt code ..... ; If TMRO is not the value we expect it to be then (presumably) ; we were delayed one extra cycle when the interrupt occurred MOVLW TMR0_KNOWN_VALUE_RIGHT_NOW SUBWF TMR0,W SKPZ ;If TMR0 is not what we expect GOTO $+1 ;then delay one cycle. Changing the subject slightly... I very often have to deal with timing; e.g. converting instruction cycles into milliseconds or whatever. It's always easy to make a mistake doing these tedious conversions. So as general advice, I suggest carrying units along with the numbers during your conversions. It's a trick you're taught (or should've been taught) in Freshman Physics. So for example, let's suppose you want to know how many instructions execute in 1/60'th of a second on a midrange PIC clocked at 10MHz. fosc = 10Mhz = 10million cycles/second Tosc = 1/fosc = 100 nSecond/ cycle Tinst = 4 cycles/instruction *Tosc = 4 cycles/instruction * 100nSeconds/cycle = 400 nSeconds/Instruction Tinterval = 1/60 seconds/Interval Now, to find the number of instructions per the 1/60'th of a second interval we need an answer that has the units of Instruction/Interval: 1 seconds 400 nSeconds Tinterval/Tinst = --- * -------- / -------------- 60 Interval Instruction 1 seconds Instruction = --- * -------- * ------------- 60 Interval 400 nSeconds 1 Instruction = ------------ * ----------- 60 * 400e-9 Interval = 41666.666... Instructions/Interval In summary, identify the units of all your variables and carry them along in your analysis. This approach works well with timer prescales and rollovers too. Scott -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics