[Icc-avr] Interrupt Help Please (Happy New Year)
Andrew
andrew_166 at msn.com
Wed Jan 2 02:18:55 PST 2008
Hi John,
Thansk for the explanation, quick question i am using the following to turn
the AT90USB162 into the lowest power sleep mode: -
SPCR = 0x00;
ACSR |= 0x80;
UCSRB = 0x00;
PRR1 |= 0x08;
REGCR |= 0x01;
port_init_off();
SMCR = 0;
SMCR = 5;
asm("sleep");
Is there anything else i am missing?
Quick Question regarding sleep mode - when the device is in sleep mode is
there anyhting else that can wake-up the AVR apart from an interrupt? also
how do i set the interrupt for INT1?
I think i write the folowing register to the following : -
EIMSK |= 0x02;
and then in the main code how do i write the C interrupt handler call code?
for example when i use the application builder to set up a timer for example
it produces the following code: -
#pragma interrupt_handler timer1_ovf_isr:19
void timer1_ovf_isr(void)
{
}
But as there is no application builder for the AT90USB162 as yet how would i
wite the above for a pin interrupt on INT1. Note Sorry i know there is
information in the datasheet but as i am new to the world of AVR's i was
just wondering if somebody could help me on this.
Thansk Andy
----- Original Message -----
From: "John Baraclough" <j_baraclough at zetnet.co.uk>
To: "Johannes Assenbaum" <jassenbaum at htp-tel.de>; "Discussion list for
ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce if you
are a member of this." <icc-avr at imagecraft.com>
Sent: Tuesday, January 01, 2008 11:53 PM
Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year)
> Hi Johannes,
>
> Actually page 84 of the AT90USB162 data sheet says:
>
> /*When the external interrupt is enabled and is configured as level
> triggered, the interrupt will trigger as long as the pin is held low. Note
> that recognition of falling or rising edge interrupts on INT7:4 requires
> the presence of an I/O clock, described in “System Clock and Clock
> Options” on page 25. Low level interrupts and the edge interrupt on
> INT3:0 are detected asynchronously. This implies that these interrupts can
> be used for waking the part also from sleep modes other than Idle mode.
> The I/O clock is halted in all sleep modes except Idle mode.*
> /
> So INT7..4 can only wake up the part from all sleep modes if it is used as
> a level interrupt and that level is maintained until the part has
> completed the wake-up. INT3..0 can be used as edge or level triggered
> interrupts to wake up the part from all sleep modes as they are detected
> asynchronously.
>
> INT1 cannot be used as a pin-change interrupt, but must be programmed to
> respond to a defined edge or level. According to Andrew's specification in
> his original post this is fine. At startup, first check that the level is
> not high already and then set the interrupt to respond to a rising edge.
> If you don't do the first check then the interrupt may never be triggered.
> When a rising edge is detected, in the ISR reset the interrupt to respond
> to a falling edge and set a semaphore for 'main()' that indicates the edge
> has been seen. 'main()' must then tidy up everything before executing the
> 'sleep' command.
>
> HTH
>
> All the best for now,
> John
>
>
> Johannes Assenbaum wrote:
>> 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
>>
>>
>
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
>
More information about the Icc-avr
mailing list