Partial preview of the text
Download Fundmentals of microcontrollers and more Lecture notes Engineering in PDF only on Docsity!
EMCH 367 Fundamentals of Microcontrollers Example 1 EXAMPLE 1 OBJECTIVE 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 the LDAA, LDAB and ABA operations Introduce immediate addressing mode ooonooo 0 Introduce inherent addressing mode PROGRAM Exi.asm program is very simple. It performs the arithmetic operation 3 + 2 = 5 using the ABA operation in immediate mode. To achieve this, the program does the following operations: 0 Load the number 3 into accA using the opcode mnemonic LDAA with operand #3. The symbol + signifies that the number 3 is used immediately. For this reason, this mode of operation is called immediate mode). 0 Load the number 2 into accB using the opcode mnemonic LDAB with operand #2, i.e.. using immediate mode QO Add the number in accA (i.e., 3) with the number in accB (1e., 2) using the opcode mnemonic ABA and no operand. This mode, which uses no operant, is called inherent mode. The symbolic representation of this process is: 393A (immediate made) 2368 (immediate mode) A+B3A (inherent mode) This signifies that number 3 is loaded into accA, number 2 is loaded into accB, and the content of accA is added to the content of accB with the result being put back into accA. EXECUTION 1. Open THRSim11. 2. Maximize THRSim11 window. 3. Close the Commands window. 4. Open file Exl.asm. Dr. Victor Giurgiutiu Page 1 1/14/2019