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

Andrew andrew_166 at msn.com
Wed Jan 2 08:34:39 PST 2008


Hi John,

My main code is basically this: -
//-----------------------------------------------------------------------------
// Sleep Function
//-----------------------------------------------------------------------------


void sleep_mode(void)
{

DF_Deep_Power_Down();
DF_Deep_Power_Down_2();

SPCR = 0x00;
ACSR |= 0x80;

UCSRB = 0x00;
PRR1 |= 0x08;
REGCR |= 0x01;

PORTD = 0x00;

//port_init_off();

SMCR = 0;
SMCR = 5;
asm("sleep");
}

//-----------------------------------------------------------------------------
// Main Program Loop
//-----------------------------------------------------------------------------
void main(void)
{

init_devices();

Usb_enable_regulator();
usb_scheduler_init();

sleep_mode();

while (1)
{


if(!TestBit(bFlags,TEST_MODE))
usb_scheduler_tasks();

}
}

//-----------------------------------------------------------------------------
// INT0 - Interruopt Handler
//-----------------------------------------------------------------------------
#pragma interrupt_handler int0_isr:iv_INT0
void int0_isr(void)
{
//external interupt on INT0
}

What i need to do is if either INT0 or INT1 go from low to high i need to 
wake the system from sleep and re-enable the USB and SPI, but i am having 
problems.INT0 goes from low to high if a USB cable is pulgged in and INT1 is 
high if the device switchs from a battery source to a main power source. 
either of these need to resut in waking the system. Then i put the system to 
sleep if INT1 is low and reset theinterrupts. Andy help would be good.

Thanks,

Andy
























----- Original Message ----- 
From: "John Baraclough" <j_baraclough at zetnet.co.uk>
To: "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: Wednesday, January 02, 2008 4:04 PM
Subject: Re: [Icc-avr] Interrupt Help Please (Happy New Year)


> The USB162 has several differences from the M162. You will need to check 
> the App Builder output against the data sheet to be sure.
>
> Andy, I will reply to your earlier post soon.
>
> John
>
> bobgardner at aol.com wrote:
>> Latest version 7.15 has M162 in app builder. Which version do you have?
>> ================================
>> 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 ------------------------------------------------------------------------
>> More new features than ever. Check out the new AOL Mail 
>> <http://o.aolcdn.com/cdn.webmail.aol.com/mailtour/aol/en-us/text.htm?ncid=aolcmp00050000000003>!
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Icc-avr mailing list
>> Icc-avr at imagecraft.com
>> http://dragonsgate.net/mailman/listinfo/icc-avr
>>
>
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
> 



More information about the Icc-avr mailing list