



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




This simple example has the following objectives: Familiarize the user with the THRSim11 simulator environment Introduce the user to the syntax and concepts of Assembly (.asm) language Familiarize the user the way arithmetic operations are handled by the microcontroller Instruct the user to interpret the List (.LST) file. Teach the user to perform the simulation and follow the step-by-step results. Introduce ADDA operation
Ex2.asm program is very simple. It performs the arithmetic operation 3 + 2 = 5 using the ADDA operation in immediate mode. To achieve this, the program does the following operations: Load the number 3 into accA using the opcode mnemonic LDAA with the operand #3, i.e., using immediate mode. Add the number in accA (which is 3) with the number 2 using the opcode mnemonic ADDA with the operand #2. (Note that the immediate mode is again used.) The symbolic representation of this process is: 3 A (immediate mode) A + 2 A (immediate mode) This signifies that number 3 is loaded into accA, number 2 is loaded into immediate memory, and the content of accA is added to of memory with the result being put back into accA.
In this simple exercise, you have learned quite a few things: New words and concepts: Opcode, opcode mnemonic, immediate mode, Assembly language (.asm), list file (.LST), reset, program counter (PC), break point, registers,. Microprocessor opcode mnemonics LDAA and ADDA Meaning of immediate mode and how to invoke it by using the symbol # Symbolic representation of the operations and their meaning Open and customize THRSim11 environment Assemble an .asm file Interpret an .LST file
Tile the THRSim11 windows (remember that the tiling sequence follows the sequence in which you accessed the files, with the most recently accessed window tiled in the left upper corner!) Put a value in a memory address, e.g. when you put zeros in the registers Set a break point Step through the program simulation and follow the changes taking place in the ‘CPU registers’ window. See how program execution is affecting accA. Identify the results of the calculation, i.e. 3 + 2 = 5 makes accA to show A 5.
EMCH 367 Fundamentals of Microcontrollers qkd4qd-821023-3288331-b-20example2-doc.doc