News:

SMF for DIYStompboxes.com!

Main Menu

AVR variables and registers

Started by bioroids, August 17, 2007, 09:01:52 PM

Previous topic - Next topic

bioroids

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
Eramos tan pobres!

Dave_B

There's a post on AVRFreaks 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:

Help build our Wiki!

bioroids

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
Eramos tan pobres!