Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

How to manually trigger a counter interrupt

How to manually trigger a counter interrupt

2005-04-17 by arhodes19044

I am using TC1 to time milliseconds for a real-time clock.  I am using 
a prescale of 1 and count to 16,000.  I could use a larger prescale, 
but this way I can adjust the clock speed slightly.

I also want to manually trigger one of the other counter channels 
(OC1C) to cause the execution of another separate interrupt.

The ATmega docs say that  I just need to raise the OCF1C in ETIFR and 
then the interrupt will be executed (on the next clock tick, I 
suppose).  Of course the interrupts need to be globally enabled.  I 
did not set the OCIE1C bit because I do not want it automatically 
counting.  When I tested the function, it did not seem to   trip the 
interrupt.

What do I do to get this technique to work?

-Tony

Re: How to manually trigger a counter interrupt

2005-04-18 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "arhodes19044" <spamiam@c...> wrote:
> The ATmega docs say that  I just need to raise the OCF1C in ETIFR
> and then the interrupt will be executed (on the next clock tick, I 
> suppose).

As I read it, OCF1C is a flag that is set when the timer meets certain 
conditions and if the corresponding interrupt is enabled, the interrupt 
will occur.  You can reset the flag by writing a 1 to it, just like 
(most of) the other such flags.

You can force an output compare (FOC1C) but I think that that does not 
generate an interrupt.  The docs say that that doing so does not assert 
OCF1C.

Don

Re: How to manually trigger a counter interrupt

2005-04-18 by arhodes19044

Yes, I would have thought that setting FOCn _should_ initiate 
everything an output compare would do.  But the docs definitely say 
it will not make an interrupt.  I guess it will just do whatever is 
programmed for the OCn pin.

I tried setting the OCF1C bit but an interrupt did not occur.  I 
tried the same with OCIE1C set (this enables the output compare 
match interrupt.  And I still did not seem to get it to work.

I would have thought I covered all the operating conditions....

-Tony


--- In AVR-Chat@yahoogroups.com, "Don Kinzer" <dkinzer@e...> wrote:
> 
> --- In AVR-Chat@yahoogroups.com, "arhodes19044" <spamiam@c...> 
wrote:
> > The ATmega docs say that  I just need to raise the OCF1C in ETIFR
> > and then the interrupt will be executed (on the next clock tick, 
I 
> > suppose).
> 
> As I read it, OCF1C is a flag that is set when the timer meets 
certain 
> conditions and if the corresponding interrupt is enabled, the 
interrupt 
> will occur.  You can reset the flag by writing a 1 to it, just 
like 
> (most of) the other such flags.
> 
> You can force an output compare (FOC1C) but I think that that does 
not 
> generate an interrupt.  The docs say that that doing so does not 
assert 
Show quoted textHide quoted text
> OCF1C.
> 
> Don

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.