On 2 Jan 2009 at 8:29, Jochen Kunz wrote:
On Thu, 1 Jan 2009 12:45:43 -0200
"Alexandre Souza" <alexandre-listas at e-secure.com.br> wrote:
AVR microcontrollers are said optimized for
C, but there is an
excellent assembler, the AVR Studio.
They are "optimized for C" in the
sense that there architecture makes
it easy to implement C. (Flat memory, lots of registers, stack ...) I
did a project in AVR assembler. AVRs are much easier to assembler code
then the i8051. (The i8051 is a braindead, awkward POS. A typical intel
design... I used it once and will never again.) Today I do all my uC
hacking with avr-gcc. The oposit may be the PIC. Due to the PIC
architecture a C implementation is a bit tricky.
Perhaps compared to an 8051, and a PIC, but literal constants in
program memory have their own addressing problems (LPM uses twice the
program space address and is the only access to program memory).
Since SP is in I/O space and not register space, it takes extra
instructions to perform stack-relative addressing (got to get SP into
X, Y, or Z) for stack-local variables, etc.
Compare that with the TI MSP430. 16 16-bit registers, PC is R0, SP
is R1, Status is R2, R3 is a "constant generator" and the rest are
uncommitted. Von Neumann architecture, 7 addressing modes...
The 8051 is a little clumsy, but a genius compared to, say, the 8x300
uC.
But C can probably be implemented on any binary uC, given enough
ugliness and memory.
Cheers,
Chuck