Avr instruction set

Solo disponible en BuenasTareas
  • Páginas : 4 (908 palabras )
  • Descarga(s) : 0
  • Publicado : 9 de febrero de 2012
Leer documento completo
Vista previa del texto
AVR035: Efficient C Coding for AVR
• • • • • • • • • • • •
Accessing I/O Memory Locations Accessing Memory Mapped I/O Accessing Data in Flash Accessing Data in EEPROM Creating EEPROM DataFiles Efficient Use of Variables and Data Types Use of Bit-field and Bit-mask Use of Macros and Functions Eighteen Ways to Reduce Code Size Five Ways to Reduce RAM Requirements Checklist forDebugging Programs Updated to Support IAR Version 2 Compilers

8-bit Microcontroller Application Note

The C High-level Language (HLL) has become increasingly popular for programmingmicrocontrollers. The advantages of using C compared to Assembler are numerous: Reduced development time, easier maintainability and portability, and easier to reuse code. The penalty can be larger code sizeand as a result of that often reduced speed. To reduce these penalties the AVR architecture is tuned to efficiently decode and execute instructions that are typically generated by C compilers. The CCompiler development was done by IAR systems before the AVR architecture and instruction set specifications were completed. The result of the co-operation between the compiler development team and theAVR development team is a microcontroller for which highly efficient, high performance code is generated. This application note describes how to utilize the advantages of the AVR architecture and thedevelopment tools to achieve more efficient C code than for any other microcontroller.

Architecture Tuned for C Code
The 32 working registers is one of the keys to efficient C coding. Theseregisters have the same function as the traditional accumulator, except that there are 32 of them. In one clock cycle, AVR can feed two arbitrary registers from the Register File to the ALU, perform anoperation, and write back the result to the Register File. When data are stored in the 32 working registers there are no need to move the data to and from memory between each arithmetic instruction....
tracking img