avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Powerdown AT90S2313


From: Bruce D. Lightner
Subject: Re: [avr-gcc-list] Powerdown AT90S2313
Date: Wed, 31 Oct 2001 09:55:49 -0800

Andreas Schlass wrote:
> 
> Hello,
> 
> can anybody help me to solve the following problem. For a battery powered
> project I want to power down the AT90S2313 after some minutes to save
> energy. In asm the modus is called "sleep". Does an equivalent c-command
> exist which is able to bring the processor in the sleep modus? Maybe someone
> has a part of code for this problem? 

Add this #define to your C code...

   #define sleep() ({ asm volatile ("sleep" "\n\t");})

Then to enter one of the sleep modes, use the following C code...

   sleep();

Note that to actually enter one of the sleep modes, first the SE bit in
MCUCR must be set (one) before the SLEEP instruction is executed.  You can
setup the MCUCR using C code "in" and "out" instructions.

> My second question is, if by using the
> gcc-compiler, is there a possibility to use asm-commands directly?

Using in-line assembly, as in the above example, is one obvious way.  This
is a complex subject.

The other is to simply write C-callable AVR assembly language files (namely
.s or .S files) and then compile them with "avr-gcc", which will "magically"
cause them to be assembled with "avr-as".

> Any help would be very welcome.
> 
> Thanks
> 
> Andreas Schlass
> address@hidden
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list

Best regards,

Bruce

-- 
 Bruce D. Lightner
 La Jolla, California
 Email: address@hidden
 URL: http://www.lightner.net/lightner/bruce/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]