DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: bioroids on August 17, 2007, 09:01:52 PM

Title: AVR variables and registers
Post by: bioroids on August 17, 2007, 09:01:52 PM
Hi!

I'm simulating some C code on AVR Studio 4 (still on the PWM phaser stuff). I noticed every variable is residing in a SRAM address, no matter if it is local, global or static. Is there a way I can indicate to the compiler to put a variable into a register instead of RAM? I think that should make the program a lot faster.

Also, is there an equivalent to HIGH() and LOW() functions on this C? Like, to extract the high or low byte of a word, without using the >> and << operators?

I'm running out of juice on the Attiny13 and I still havent implemented the Tap tempo I wanted! 1K memory is just too small!

Regards!

Miguel
Title: Re: AVR variables and registers
Post by: Dave_B on August 18, 2007, 02:51:46 AM
There's a post on AVRFreaks (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&theme=print&p=349045) that mentions the "register" keyword in the GCC compiler.  Apparently it's not foolproof.

I'm an assembler guy, so I'm just Googling.   :icon_confused:

Title: Re: AVR variables and registers
Post by: bioroids on August 19, 2007, 05:09:51 PM
Thanks for the link Dave!

It seems I managed to reduce my code a 50%, so there's no need to optimize (still  :icon_cool:), or going the ASM way

Regards

Miguel