Hello drthilina,
I recently switched to programming AVR from PICs for curiosity sake, and MY GOD...!!! those have the speed. they are simple simple but brutal (this is just my experience).
Glad to hear that..
but I was baffled about some issues regarding the memory usage... as an argument, if AVR poses larger assembly instruction set, it should mean that the code it generates should be lesser compared to PICs
No, that may not be the case always. AVR has load-act-store architecture, that means you will have to move your operands from memory to one of 32 the working registers before doing any operation & store it back to memory. PIC on the other hand can directly work on any of its memory location, but PIC memory is not continuous & is segmented/banked to allow smaller opcode size. AVR can access upto 64k memory with same pointers(x,y,z).
There are couple of other advanteges which you will notice once you start using avr.
Don't know whether its the compiler but I feel the code can be much lesser than what is usually given via winAVR. recently I stumbled upon a mysterious situation, I was using the delay.h header and when I tried pass a variable from source file to my own header file which passed it then to delay.h via _delay_ms(XXX) the code size was 69% of ATmega's capacity, when I replaced those XXX (or variable) with constant ie. _delay_ms(100) the code shrunk to 20%.
By god ..
If you decide to use WinAVR(for that matter any gnu tools) make habit of reading help files thouroughly. Look at delay.h in 'avr/util' directory of your winavr installation. delay_xxx() functions have declaration,
void _delay_ms( double );
void _delay_us( double );
delay.h & avr_libc docs specifically "notes" that if you pass a variable to these function they will calculate all the constants needed for delay using "double" precision. That means all the floating point library is included in your final image. On the other hand if you pass them a compie time constant then preprocessor will calculate necessary constants.
Look at you '.lss' or '.map' file in both cases, you will get why there is so huge code-difference.
regards,
sam_des