It would return to goto loop. The sleep instruction has already been executed.
Well, it does not work as expected.
First I have a problem with the other interrupts (I poster a message today about this) but with my settings I was expecting a TMR0 overflow evey 10ms but it happens every 1ms...
TMR0 starts at 98, and I'm using a 8MHz intosc.
0.5Us per instruction cycle (FOSC/4).
Strange...
8,000,000 Hz oscillator / 4 = 2,000,000 instructions/second = 2,000,000 increments of TMR0 using a prescale of 1:1 (prescaler assigned to WDT).
TMR0 is an 8 bit timer, max count = 256. You're reloading it with 98, leaves you with 158 counts.
2,000,000 / 158 = 12,658.228 Hz = 79us per interrupt.
2,000,000 / 256 = 7812.5 Hz = 128us per interrupt.
So, you're 10ms theory (since we don't have any better information) isn't going to work.
But this might:
http://www.mister-e.org/pages/picmulticalcpag.html
8Mh/4 = 2000000 op per s.
1:128 prescale = 2000000/128 = 15625 per s.
Preload with 98, 158 counts.
15628 / 158 = 98.89 Hz
1000ms/100 = 10ms
What's wrong?
You left out that vital bit of information (the 1:128 prescale).
So, it's happening every 1ms instead of 10ms?
Are you sure you're correctly clearing/re-enabling the correct interrupt after you are done processing the interrupt...or is the interrupt sequence 'jumping right back into itself' after you are done processing it?
Last edited by skimask; - 19th August 2008 at 16:07.
Bookmarks