[Icc-avr] Interrupt Help Please (Happy New Year)

Johannes Assenbaum jassenbaum at htp-tel.de
Tue Jan 1 12:51:09 PST 2008


Hi Andrew,

as datasheet tells, only INT7..4 level interrupts are able to wake up CPU from sleep mode other than idle.

As I understand, this will not fit your needs.

Best regards,
Johannes


> Hi,

> Can somebody explain/show how i can get an interrupt on a pin change. I am using
> the AT90USB162 and the pin i need to monitor for change is on PORTD 1 which is
> INT1.

> Basically i need to go to sleep if it goes from low to high. and wake if it goes
> from high to low. I think the code should be something like this :-


>  #pragma interrupt_handler XXXX_isr:XX
> void Pin_State_Change(void)
> {

> CHECK THE STATE OF THE PIN

> IF (PIN STATE HAS CHANGED)
> {
> MAKE PIN_FLAG = 0X02
> }


> void main()
> {


> if (pin_changed == 0x01)
> {
>  SMCR = 5;
>  asm("sleep");
> }


> }

> I could just using polling in my main code to check the Pin state has changed but
> then if i call: -

> asm("sleep");

> how do i get the AVR to wake up again and re-enable all the devices??

> If somebody has an example of pin interrupts they can send that will help me
> understand them and the sleep function that would be much appriceated.

> Many Thanks (Happy New Year ALL)


> Andrew






More information about the Icc-avr mailing list