Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] generating external interrup in SW

2005-09-30 by David Kelly

On Sep 29, 2005, at 9:29 PM, Aaron wrote:

> On a mega48, I am trying to generate a external interrupt in the
> software by writing:
>     sbi EIFR, INTF0     ; simulate a step in test mode by setting INT0
> flag (step input)
>
> But this doesn't seem to work  -- neither in the simulator nor on real
> hardware.
>
> I am 99% sure INT0 is set up properly because the interrupt vector
> executes if a falling edge is applied to the pin.
>
> Is my method of generating an external interrupt in software valid, or
> am I missing something?

On the AVR one *writes* a 1 to the flag register to *clear* the flag.  
There is no way to set the flag without tickling the external INT0 pin.

IIRC you can't write to the INT0 port pin to trigger the IRQ because  
the act of enabling the IRQ disables it as an output.

Only way I can think to do what you ask is to wire another output  
port pin to your INT0 input.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

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.