I can't seem to set a regular interrupt on the ATTINY2313A (that i can adjust). The interrupt occurs, but the timing does not seem to change when i change the output compare value. Can someone explain how i set up timer1 or timer0 as i timer until it reaches a set value and then cause an interrupt. I cant seem to get it to work as per description in the help files (a timer overflow interrupt seems to occur rather than the interrupt occuring when TCNT1 reaches compare_a.
Here is the example that causes TOVF interrupt rather than Output compare interrupt. What is wrong? Why wont this trigger an interrupt on Comparea?? Is this compiler bug or my misunderstanding?
Config Timer1 = Timer , Prescale = 8 , Compare_a = Disconnect , Compare_b = Disconnect , Clear_timer = 1
Compare1a = 31250 'when the timer reaches 31250 (0.25 sec) cause an interrupt
On Timer1 Tim1_isr
Enable Timer1 ' enable the interrupt
Start Timer1
Enable Interrupts
Start Timer1
AND ISR ROUTINE:
Tim1_isr:
Compare1a = 31250 'reload the timer with .25 sec. With 8 prescaler 1 bit in timer = 8 microsec
Return
[b:6af3a9776c][color=red:6af3a9776c](BASCOM-AVR version : 2.0.7.6 )[/b:6af3a9776c][/color:6af3a9776c]
↧