Hi mackrackit, everyone.
I've been doing a lot of reading trying to figure out what's actually going within your Timer / Interrupt program. So here's my interpretation (he typed as he makes a fool of himself again).....!
Code:
INTCON.5 = 1 'ENABLE TMR0
Setting the Interrupt_Control pin.5 = 1 simply enables the Timer0 interrupt.
Code:
OPTION_REG = %10000101 '16BIT 1:64 PRESCALE
First of all you set the Global Interrupt Enable bit.7 =1.
Then bits 0 = 1 & bit 2 = 1 sets the PRESCALE value 1/64 of the system clock.
4MHZ or the instruction clock 1MHZ (not 100% sure on that one) This divided down figure is then sent to the TIMER0 register (incremented count from the prescaler).
When the count goes from FF(HEX) +1 (255 decimal,it over-runs back to zero).
So (wild assumption here) when the count overflows passed 255 the INTERRUPT occurs and the program jumps to the Label TLOOP. The LED blinks, then INTCON.2 pin is the reset to 0 and it does it all again.
So basically to my (small) mind the LED would blink every 1/64th of 1MHZ.
Anywhere warm on this one?
Dave
Bookmarks