Its very confusing as even mchip recomends: "When writing to TMR0, two instruction clock cycles are lost. Often you have a specific time period you want to count, say 100 decimal. In that case you might put 156 into TMR0 (256 - 100 = 156). However, since two instruction cycles are lost when you write to TMR0 (for internal logic synchronization), you should actually write 158 to the timer." But that doesnt take into account the instruction that the write occured in. That combined with all the simulating I did before the bug fix really threw me. Thanks! - Ben --- Jason Harper wrote: > Actually, it sounds like Microchip has finally fixed a long-standing > bug in > the simulator... > > There is actually a 3-cycle fudge factor when adding a value to TMR0: > on > the cycle of the add itself, the pre-incremented timer value is read, > and > the result of the addition overwrites the incremented value, so > effectively > no increment happens that cycle. This is followed by two cycles in > which > no increment happens, as documented. I think that if you were to try > your > program in an actual PIC, you'd find that the simulator results now > match > reality. > Jason Harper > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.