In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dkemppai wrote: [quote="pjv"] Hi Bean; Something you may not be aware of because it's not really dealt with in the SX documentation, and that is anytime you do a write, or read-modify-write, to the RTCC, it "eats" 3 clock cycles. So if your trick writes to the RTCC - and I suspect CLR RTCC might fall into that category but needs to be confirmed- then you need to account for those 3 cycles. And in testing this, please be careful, as the debug IDE will not show the proper count....... if I recall correctly, it is out by one. Cheers, Peter (pjv)[/quote]This my version of modifying the RTCC time... [code] mov RTCC,#47 ;Sets RTCC Cycles = ((255 - x) +3 +3 +3) ;Where x is (mov RTCC,#x) ;for x = #47, RTCC happens every 217 [/code] I've experimentally found that the interrupt taks 3 cycles in, 3 cycles out, and there are 3 more lost in the confusion. I measured the time on an o-scope... ...and adjust my math accordingly. It also took a while to figure out what was going on. Of course I wasn't using a prescaler on anything here ;) -Dan ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=249607#m249985 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)