Example: barber

Beginners Introduction to the Assembly Language of ATMEL ...

Beginners Introduction to theAssembly Language ofATMEL AVR MicroprocessorsbyGerhard asm 2016 History:Corrected a calculation error in May 2016 Added page on assembler concept in February 2011 Added chapter on code structures in April 2009 Additional corrections and updates as of January 2008 Corrected version as of July 2006 Original version as of December 2003 Avr-Asm-Tutorial1 1 Why learning Assembler?..1 2 The concept behind the Language assembler in micro The hardware of micro How the CPU Instructions in Difference to high level Assembler is not machine Interpreting and High level languages and What is really easier in assembler?..5 3 Hardware for AVR Assembler The ISP Interface of the AVR processor Programmer for the PC Parallel Experimental Experimental board with an Experimental board with an AT90S2313 Ready to use commercial programming boards for the AVR AVR 4 Tools for AVR Assembly The A simple Structuring assembler The Programming the Simulation in the 5 What

Avr-Asm-Tutorial 1 http://www.avr-asm-tutorial.net 1 Why learning Assembler? Assembler or other languages, that is the question. Why should I learn another language ...

Tags:

  Language, Assembly, Assembly language

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Beginners Introduction to the Assembly Language of ATMEL ...

1 Beginners Introduction to theAssembly Language ofATMEL AVR MicroprocessorsbyGerhard asm 2016 History:Corrected a calculation error in May 2016 Added page on assembler concept in February 2011 Added chapter on code structures in April 2009 Additional corrections and updates as of January 2008 Corrected version as of July 2006 Original version as of December 2003 Avr-Asm-Tutorial1 1 Why learning Assembler?..1 2 The concept behind the Language assembler in micro The hardware of micro How the CPU Instructions in Difference to high level Assembler is not machine Interpreting and High level languages and What is really easier in assembler?..5 3 Hardware for AVR Assembler The ISP Interface of the AVR processor Programmer for the PC Parallel Experimental Experimental board with an Experimental board with an AT90S2313 Ready to use commercial programming boards for the AVR AVR 4 Tools for AVR Assembly The A simple Structuring assembler The Programming the Simulation in the 5 What is a register?

2 21 Different Pointer Accessing memory locations with Reading program flash memory with the Z Tables in the program flash Accessing registers with Recommendation for the use of 6 What is a Port?..25 Write access to Read access to Read Modify Write access to Memory mapped port Details of relevant ports in the The status register as the most used Port 7 What is SRAM?..29 For what purposes can I use SRAM?..29 How to use SRAM?..29 Direct Pointer Pointer with Use of SRAM as Defining SRAM as Use of the Common bugs with the stack 8 Jumping and Controlling sequential execution of the Linear program execution and Timing during program Macros and program Interrupts and program 9 Number systems in Positive whole numbers (bytes, words, etc.)

3 39 Signed numbers (integers)..39 Binary Coded Digits, Packed Numbers in ASCII Bit Shift and Adding, subtracting and Adding and subtracting 16 bit Comparing 16 bit Comparing with Packed BCD Format conversion for Conversion of packed BCDs to BCDs, ASCII or Conversion of Binaries to Decimal Binary AVR assembler Binary Multiplication in the Hardware Hardware multiplication of 8 by 8 bit Hardware multiplication of a 16 by an 8 bit Hardware multiplication of a 16 by a 16 bit Hardware multiplication of a 16 by a 24 bit Decimal Binary Program steps during Division in the Number Decimal Linear Example 1.

4 8 bit AD converter with fixed decimal Example 2: 10 bit AD converter with fixed decimal 10 Project How to plan an AVR project in Hardware Considerations on interrupt Basic requirements of interrupt driven Example for an interrupt driven assembler Considerations on 11 Instructions sorted by Directives and Instruction lists in alphabetic Assembler directives in alphabetic Instructions in alphabetic Port Status Register, Accumulator SRAM and External Interrupt External Interrupt Timer Interrupt Timer/Counter Timer/Counter Watchdog Serial Peripheral Interface Analog I/O Ports, alphabetic List of 1 Why learning Assembler?

5 Assembler or other languages, that is the question. Why should I learn another Language , if I already learned otherprogramming languages? The best argument: while you live in France you are able to get through by speaking English, butyou will never feel at home then, and life remains complicated. You can get through with this, but it is rather things need a hurry, you should use the country's people that are deeper into programming AVRs and use higher-level languages in their daily work recommend thatbeginners start with learning Assembly Language . The reason is that sometimes, namely in the following cases: if bugs have to be analyzed, if the program executes different than designed and expected, if the higher-level Language doesn't support the use of certain hardware features, if time-critical in line routines require Assembly Language portions,it is necessary to understand Assembly Language , e.

6 G. to understand what the higher-level Language compiler understanding Assembly Language you do not have a chance to proceed further in these and easyAssembler instructions translate one by one to executed machine instructions. The processor needs only to execute whatyou want it to do and what is necessary to perform the task. No extra loops and unnecessary features blow up thegenerated code. If your program storage is short and limited and you have to optimize your program to fit into memory,assembler is choice 1. Shorter programs are easier to debug, every step makes sense. Fast and quickBecause only necessary code steps are executed, Assembly programs are as fast as possible. The duration of every step isknown.

7 Time critical applications, like time measurements without a hardware timer, that should perform excellent, mustbe written in assembler. If you have more time and don't mind if your chip remains 99% in a wait state type of operation,you can choose any Language you want. Assembler is easy to learnIt is not true that Assembly Language is more complicated or not as easy to understand than other languages. Learningassembly Language for whatever hardware type brings you to understand the basic concepts of any other assemblylanguage dialects. Adding other dialects later is easy. As some features are hardware-dependent optimal code requiressome familiarity with the hardware concept and the dialect. What makes assembler sometimes look complicated is that itrequires an understanding of the controller's hardware functions.

8 Consider this an advantage: by learning assemblylanguage you simultaneously learn more about the hardware. Higher level languages often do not allow you to use specialhardware features and so hide these first Assembly code does not look very attractive, with every 100 additional lines programmed it looks better. Perfectprograms require some thousand lines of code of exercise, and optimization requires lots of work. The first steps are hardin any Language . After some weeks of programming you will laugh if you go through your first code. Some assemblerinstructions need some months of experience. AVRs are ideal for learning assemblerAssembler programs are a little bit silly: the chip executes anything you tell it to do, and does not ask you if you are sureoverwriting this and that.

9 All protection features must be programmed by you, the chip does exactly anything like it is told,even if it doesn't make any sense. No window warns you, unless you programmed it correct typing errors is as easy or complicated as in any other Language . Basic design errors, the more tricky type oferrors, are also as complicated to debug like in any other computer Language . But: testing programs on ATMEL chips is veryeasy. If it does not do what you expect it to do, you can easily add some diagnostic lines to the code, reprogram the chipand test it. Bye, bye to you EPROM programmers, to the UV lamps used to erase your test program, to you pins that don'tfit into the socket after having them removed some dozen are now programmed fast, compiled in no time, and either simulated in the studio or checked in-circuit.

10 No pin isremoved, and no UV lamp gives up just in the moment when you had your excellent idea about that bug. Test it!Be patient doing your first steps! If you are familiar with another (high-level) Language : forget it for the first time. Behindevery assembler Language there is a certain hardware concept. Most of the special features of other computer languagesdon't make any sense in first five instructions are not easy to learn, after that your learning speed rises fast. After you had your first lines: grabthe instruction set list and lay back in the bathtub, wondering what all the other instructions are warning: Don't try to program a mega-machine to start with. This does not make sense in any computer Language ,and just produces frustration.


Related search queries