[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] ATmega644 pin-change interrupts
From: |
David Kelly |
Subject: |
Re: [avr-gcc-list] ATmega644 pin-change interrupts |
Date: |
Thu, 29 Nov 2007 09:25:12 -0600 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Nov 29, 2007 at 03:44:18PM +0100, Per-Tore Aasestrand wrote:
> Hi list,
>
> I am using an ATmega644 and is attempting to set up pin-change
> interrupts for ports PA4/PCINT4 & PA5/PCINT5. I've used the following
> code. Apparently, no interrupts are coming. Any obvious faults?
You need to enable to desired pins in PCMSKx.
> When in the interrupt handler, how should a decide what pin created
> the interrupt? I can't find a flag-bit that carries this information.
I too have not found one. I snag a copy of the PINx and keep it in a
static variable in my ISR() to compare for which pins changed. Something
like this:
current = PINA & PCMSK0; // only the pins enabled
xor = previous ^ current; // pins changed since last time
...
previous = current;
return;
--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.