Unformatted text preview:

Exercise 3-7General NoteObjectiveprogramcoding and executionSection: 8 + 7 = 15 (decimal) using the opcode mnemonics LDAA, LDAB, ABASection: $08 + $07 = $0f (hex) using the opcode mnemonics LDAA, LDAB, ABASection: 9 + 9 = 18 (decimal) using the opcode mnemonics LDAA, LDAB, ABASection: $09 + $09 = $12 (hex) using the opcode mnemonics LDAA, adda,Section: $09 + $09 = $12 (hex) using the opcode mnemonics LDAA, LDAB, ABASection: 12 + 29 = 41 (decimal) using the opcode mnemonics LDAA, LDAB, ABASection: $0c + $1d = $29 (hex) using the opcode mnemonics LDAA, LDAB, ABA$ff + $01 = $00 (hex) using the opcode mnemonics LDAA, ADDA255 + 1 = 0 (decimal) using the opcode mnemonics LDAA, ADDAWhat you have learnedEMCH 367 Fundamentals of Microcontrollers Exercises 3-7EXERCISE 3-7GENERAL NOTE- Before starting this exercise, read Examples 3, 4, 5, 6, 7 and work through them using theTHRSim11 simulator.- Then, read this exercise. You will notice that the present exercise is practically identical with theseexamples, only that is uses different numbers.- 'Save As' this Word file in the personalized format indicated in the course pack.- To complete the exercise, you will have to do the following:- Type in text The exercise has 6 sections. Do them in sequence.OBJECTIVEThis exercise has the following objectives:- Review decimal numbers and decimal symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9- Review the decimal carry concept, i.e., when a result is outside the 0 – 9 range- Review 2-digit decimal arithmetic with carry- Prepare the ground for hex arithmetic- Introduce hex numbers and hex symbols: a, b, c, d, e, f- Introduce2-digit hex arithmetic- Introduce 2-digit hex carry as a repeated incrementation- Introduce 2-digit hex arithmetic with carry- Introduce the ‘lost carry’ concept- Introduce MSB carry- Introduce single precision and double precision register conceptsNote: To facilitate understanding, the same numbers are used in both decimal and the hex cases.Dr. Victor Giurgiutiu Page 1 1/15/2019EMCH 367 Fundamentals of Microcontrollers Exercises 3-7PROGRAMYou have to write .asm code to perform the arithmetic operations listed below:i) 8 + 7 = 15 (decimal) using the opcode mnemonics LDAA, LDAB, ABAii) $08 + $07 = $0f (hex) using the opcode mnemonics LDAA, LDAB, ABAiii) 9 + 9 = 18 (decimal) using the opcode mnemonics LDAA, LDAB, ABAiv) $09 + $09 = $12 (hex half carry) using the opcode mnemonics LDAA, ADDAv) $09 + $09 = $12 (hex) using the opcode mnemonics LDAA, LDAB, ABAvi) 12 + 29 = 41 (decimal) using the opcode mnemonics LDAA, LDAB, ABAvii) $0c + $1d = $29 (hex) using the opcode mnemonics LDAA, LDAB, ABAviii) $ff + $01 = $00 (MSB carry) using the opcode mnemonics LDAA, ADDAix) 255 + 1 = 0 (decimal equivalent of a MSB carry) using the opcode mnemonics LDAA, ADDACODING AND EXECUTION Open THRSim11. Maximize THRSim11 window. Close the Commands window.Open the template.asm file and save it with the personalized name LASTNAME_Firstname_Ex3-7(Please respect the upper and lower conventions.). Type your program in the .asm window after the line saying *Begin typing your code.Assemble your file, tile the windows, set the breakpoint, and reset the registers.Paste the screen capture here. 1 point(s)SECTION: 8 + 7 = 15 (DECIMAL) USING THE OPCODE MNEMONICS LDAA, LDAB, ABAReset accA and accB by typing zero into them. Set the display option of accA and accB to Decimal.Use the Step button to step through this section of your program. Explain:- Which are the MSD and the LSD in the result 15? What do they represent? 3 point(s)- What is a decimal carry 2 point(s)- Did a decimal carry happen or not? Why? 3 point(s)SECTION: $08 + $07 = $0F (HEX) USING THE OPCODE MNEMONICS LDAA, LDAB, ABAReset accA and accB by typing zero into them. Set the display option of accA and accB to hex.Use the Step button to step through this section of your program. Explain:Dr. Victor Giurgiutiu Page 2 1/15/2019EMCH 367 Fundamentals of Microcontrollers Exercises 3-7- How many digits are used to represent the number eight in hex on the simulator? Why? 3point(s)- What is the meaning of concatenation? 2 point(s)- Which registers are concatenated and what is the result of the concatenation? 2 point(s)- What was the content of accD after you loaded $08 in accA? Why? 3 point(s)- What was the content of accD after you loaded $08 in accA and $07 in accB? Why? 2 point(s)- What is a hex carry 2 point(s)- Did a hex carry happen or not? Why? 2 point(s)SECTION: 9 + 9 = 18 (DECIMAL) USING THE OPCODE MNEMONICS LDAA, LDAB, ABAReset accA and accB by typing zero into them. Set the display option of accA and accB to Decimal.Use the Step button to step through this section of your program. Explain:- What is a decimal carry 2 point(s)- Did a decimal carry happen or not? Why? 2 point(s)SECTION: $09 + $09 = $12 (HEX) USING THE OPCODE MNEMONICS LDAA, ADDA,Part I: start with $09 in accA and increment by 1 using the ADDA opcodeReset accA and accB by typing zero into them. Set the display option of accA and accB to hex.Use the Step button to step through this section of your program until the first has been executed.Use the Step button to step further through this section of your program until accA has reached thevalue $0f.Use the Step button to do an additional step through this section of your program. AccA should changeto $10. Use the Step button to do further step through this section of your program until the operation $09 +$09 = $12 using is completed.Explain:- Did a hex carry happen or not? Why? 3 point(s)- After how many executions has the carry happen? 2 point(s)- What was the value of accA before the hex carry? 2 point(s)- What was the value of accA after the hex carry? 2 point(s)- What was the final value of accA? 2 point(s)SECTION: $09 + $09 = $12 (HEX) USING THE OPCODE MNEMONICS LDAA, LDAB, ABAPart II: start with $09 in accA and $09 in accB. Do the addition using the ABA opcodeDr. Victor Giurgiutiu Page 3 1/15/2019EMCH 367 Fundamentals of Microcontrollers Exercises 3-7Reset accA and accB by typing zero into them. Set the display option of accA and accB to hex.Use the Step button to step through this section of your program. Explain:- Did a hex carry happen or not? Why? 3 point(s)- What is the hex result of your operation? 2 point(s)- What is the MSD of the result? What does is signify? 3 point(s)- What is the LSD of the result? What does it signify? 3 point(s)- What is the decimal


View Full Document

SC EMCH 367 - Exercise3-7

Download Exercise3-7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Exercise3-7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Exercise3-7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?