Posted: Thu Apr 07, 2016 7:57 am Post subject: Interrupt on every timer 1 tick?
If I configure Timer 1 to have a prescaler 0f 1024 on an ATMEGA 1284p, does anyone know how to get an interrupt in BASCOM each time a "tick" occurs?
I know that we can get an interrupt (and have an ISR service that interrupt) when the timer overflows. But is there a way to get an interrupt (and ISR to go with it) each time 1024 crystal ticks occur causing 1 pre-scaled Timer 1 tick?
Bascom only can use what's provided by the HW and there's no such option within the controller.
The nearest way to achieve what you want is, if you set up the timer with prescale 1, option Clear_Timer = 1 and Compare1A set to 1023.
It gives you one interrupt per 1024 µc-clocks, in the timer ISR you can set up a software counter, that does whatever desired.
However this approach will eat up quite some processor time, as for example an ISR with length of 150 µc-clocks called every 1024 µc-clocks means a load of roughly 15 percent.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum