>
> The code below is still not working, but some other code using the
> external interupt mechanism strictly to execute a routine is
> running. The difficulty there was using:
> sts EIMSK, areg
> rather than:
> out EIMSK, areg.
>
> Possibly, considering the code below, the clock for the interupts
> is disabled unless both the specific mask bit and the master
> interupt bit are set, rendering the interupts inoperative as an
> inspection tool for transitions at a pin. There is probably some
> other explanation since sacrificing significant function for
> marginal power reduction might cause a ripple in Atmel's design
> circle. Then again, power reduction is fashionable. If anyone
> sees a way to implement the code below or an alternate means to
> achieve the same result, please mention it.
comp.arch.embedded
programming atmega48
The code below is still not working, but some other code using the
external interupt mechanism strictly to execute a routine is running. The
difficulty there was using:
sts EIMSK, areg
rather than:
out EIMSK, areg.
Possibly, considering the code below, the clock for the interupts is
disabled unless both the specific mask bit and the master interupt bit are
set, rendering the interupts inoperative as an inspection tool for transitions
at a pin. There is probably some other explanation since sacrificing
significant function for marginal power reduction might cause a ripple in
Atmel's design circle. Then again, power reduction is fashionable...
If anyone sees a way to implement the code below or an alternate means
to achieve the same result, please mention it.
Hul
>Good thought - I'll check on the ports & such.
>
>Hul
>larwe <zwsdotcom@gmail.com> wrote:
>> I had a similar problem - I was tearing my hair out - trying to poll
>> interrupts on an ATmega649. It turned out that I was using the wrong
>> header file (for the 169) and the bit assignments were NOT the same!
>> Moral: check which bits you're actually sampling vs. what you're
>> supposed to be sampling; I see magic numbers in your code snippet.
>>> The code below is intended to detect a rising transition on the
>>>external interput pin by sampling the flag register but it doesn't work on
>>>an atmega48. With the ei-mask bit set (no sei), the code didn't detect a
>>>transition either.
>>> On an atmega162 this does work, however, and the documentation
>>>describes the functioning of the flags in the same manner. Perhaps the 48
>>>requires setting something I missed. Any suggestions?
>>>
>>>Hul
>>>
>>> ldi areg, 0xc ; set external irpt 1 for rising edge
>>> sts EICRA, areg
>>> sbi EIFR, 1 ; clear flag in ext irpt 1 - number 1 bit
>>>
>>> ; stalling untill meas device is connected & running
>>>exirst1:
>>> in areg, EIFR
>>> andi areg, 2 ; check flags existence
>>> brz exirst1 ; & wait if not there