ECE2560 Autumn 2013 ‐ Final ‐ Page01 of 06

ECE2560 Autumn 2013 ‐ Final ‐ Page01 of 06
Final Exam ECE2560 Autumn 2013
There are a total of 20 Problems. Each problem is worth 5 points.
Last Name: _________________ First Name: ____________________
Prob. 1: What is the size of the RAM and ROM in the microcontroller used in this class.
Prob. 2: What dose GPIO stand for?
Prob. 3: Write code to define a symbolic constant named con1 and assign a value of 4 to it.
Prob. 4: Which of the following statements is correct:
a) A symbolic constant must to be placed after a .data statement
b) A symbolic constant must to be placed after a .text statement
c) A symbolic constant can be placed after a .text or .data statement
Prob. 5: What is meant by the term Memory Mapped?
Prob. 6: Does the code sitting inside your microcontroller consist of Assembly Language or Machine Language instructions?
Final_sol Page 1
ECE2560 Autumn 2013 ‐ Final ‐ Page02 of 06
Prob. 7: Given:
.data
x: .word 23
y: .word ‐3
Write assembly code for the following pseudo‐code:
if(x <= 4)
{ y = 0;
}
else
{
y=1;
}
Prob. 8: Given:
.text
var1: .word 23
var2: .word ‐3
What are the contents of register R5 after the following statements are executed?
add.w &var1, &var2
mov.w &var2, R5
Final_sol Page 2
ECE2560 Autumn 2013 ‐ Final ‐ Page03 of 06
Prob. 9: Given:
.data
x: .word 23
y: .word ‐3
Write assembly code for the following pseudo‐code:
if( the 4th bit of x is set )
{ y = 0;
}
Note: The least significant bit is the 0th bit.
Prob. 10: Given:
.data
var1: .word 1
Write assembly code to set the 0th, 2nd and 11th bit of var1 using the bis.w
instruction.
Final_sol Page 3
ECE2560 Autumn 2013 ‐ Final ‐ Page04 of 06
Prob. 11: Given:
.data
var1: .word 23
var2: .word ‐3
What is contained in register R5 (in hex) after the following statements are executed?
add.w #var2, &var1
mov.w &var1, R5
Prob. 12: Given:
.data
var1: .word 23
Write code that multiplies var1 by 8 using bit shifting and puts the result in the core register R5. Prob. 13: What does ISR stand for?
Prob. 14: Define what is meant by the "free store".
Final_sol Page 4
ECE2560 Autumn 2013 ‐ Final ‐ Page05 of 06
Prob. 15: Write configuration code to configure pin P2.1 for digital input, pull up resistor
and no interrupts
Prob. 16: Write configuration code to configure pin P2.1 for digital input, no resistor and
interrupt on lowering edge
Prob. 17: Partial code to enable the interrupt service routine requested from the Analog to Digital Converter ADC10 is give below. Fill in the blank. ; Interrupt Vectors
.sect _____________________
.short ADC10_ISR
Prob. 18: What is the address of the Port2 interrupt vector? Is this vector single sourced
or multiple sourced?
Final_sol Page 5
ECE2560 Autumn 2013 ‐ Final ‐ Page06 of 06
Prob. 19: A subroutine named MySub takes three inputs (words) and returns one output (word). All inputs and outputs are handled via the stack. Write code to call this subroutine with inputs of 8, 5 and ‐2. Your calling code should store the value of the output in the core register R5. Prob. 20: Regarding problem 19 above, fill out the stack picture given below once the subroutine has just started to execute (you may use the terms "return address", "junk" or "output" to fill in some of these blanks)
0(SP) _________________
2(SP) _________________
6(SP) _________________
8(SP) _________________
10(SP) _________________
Final_sol Page 6