Just trying to understand where the TMR1H and TMR1L registers are getting loaded to determine the time constant of the blinky light? This interrupt is based on an overflow, right?
Just trying to understand where the TMR1H and TMR1L registers are getting loaded to determine the time constant of the blinky light? This interrupt is based on an overflow, right?
T1CON = $31 sets the prescaler to 8 and turns on timer1. The interrupt is on overflow.
Timer1 overflows in 8 * 65536 * 1uS if you're using a 4MHx oscillator.
So TMR1L & TMR1H aren't even used? Is it possible to increase the time without changing the oscillator frequency? In this case I'm using a 18F67J60 at 20Mhz, and it's just timing out too fast.
This particular example doesn't reload TMR1L & TMR1H. It just lets timer1 count up to its max 16-bit value, then overflow.
A simple way to extend the time would be to increment a variable counter in the interrupt, then toggled the LED after X number of counts, and reset the count back to 0.
Or, on the 18F67J60, you could use timer0 in 16-bit mode with a prescaler of 1:256. That would give you >3 seconds until overflow.
OK. I'll start with incrementing a variable, and go from there. Theres a lot to learn with these timers.
They may seem a tad intimidating at first, but once you've played around with timers a bit, you might find them fairly easy.Theres a lot to learn with these timers.
But, the time you spend on learning timers is like a BB in a 55-gallon drum compared to the time & effort DT put into his instant interrupts.
Here's to Darrel...;o)
You're telling me! I've got a program going that's implemented 3 interrupts. I would have never believed it. I used to avoid interrupts at all costs. Darrel's routines make them so easy. Thanks Darrel!
Bookmarks