Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:avr:architecture [2010/10/02 05:34] allan.pettaien:avr:architecture [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 37: Line 37:
 </box> </box>
  
-===== Program stack =====+===== Program Stack =====
  
-Stack is a data structure, where the last data written to the memory is read out first. AVR's stack can be used while operating with subroutines, interrupts and temporary data. Before executing a subroutine or interrupt, the address in the program counter where the program was interrupted is stored in the stack. When the subroutine or interrupt has finished its execution, this address is read back from the stack and the program continues from the address it left off before. Storing temporary data in the stack is usually used when dealing with shorter chunks of code, which do not require reserved memory throughout the execution of the program. Simpler assembler programs are usually written so that it is not necessary to use the stack, but if the program contains a lot of variables and functions, the compilers automatically make use of it.+Stack is a data structure, where the last data written to the memory is read out first. AVR's stack can be used while operating with subroutines, interrupts and temporary data. Before executing a subroutine or interrupt, the address in the program counter where the program was interrupted is stored in the stack. When the subroutine or interrupt has finished its execution, this address is read back from the stack and the program continues from the address it left off from before. Storing temporary data in the stack is usually used when dealing with shorter chunks of code, which do not require reserved memory throughout the execution of the program. Simpler assembler programs are usually written so that it is not necessary to use the stack, but if the program contains a lot of variables and functions, the compilers automatically make use of it.
  
 The stack of MegaAVR series microcontrollers is physically located in the random access memory. Some tinyAVR series devices do not have a random access memory at all and the stack is realized as a separate, quite limited memory unit. Typically there are no compilers for devices with no random access memory. The stack of MegaAVR series microcontrollers is physically located in the random access memory. Some tinyAVR series devices do not have a random access memory at all and the stack is realized as a separate, quite limited memory unit. Typically there are no compilers for devices with no random access memory.
  
 To program in a high level language (Pascal, C, C++), it is not necessary to be familiar with the inner workings of the microcontroller, because the compiler is capable of selecting general purpose registers and instructions by itself, but knowing what goes on in the controller is certainly beneficial. It is necessary to know the instructions of the microcontroller when developing time-critical applications, where the operations have to be completed in a limited amount of cycles. To program in a high level language (Pascal, C, C++), it is not necessary to be familiar with the inner workings of the microcontroller, because the compiler is capable of selecting general purpose registers and instructions by itself, but knowing what goes on in the controller is certainly beneficial. It is necessary to know the instructions of the microcontroller when developing time-critical applications, where the operations have to be completed in a limited amount of cycles.
en/avr/architecture.1285997673.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0