You are on page 1of 1

Department of Mechatronics and Control Engineering

University of Engineering and Technology Lahore


MCT-222 Embedded Systems (Spring-2022)
Final Quiz
Time: 10 min Marks: 15 Student Name: Reg. #:
[CLO1] Explain general architecture of microcontrollers along with programming framework.
A [5 Points] State the term, symbol, or expression that is best described by each definition.
i. Order in which least significant value in the sequence is stored first. Little-endian
ii. The processor always fetches the next instruction to be executed from PC/R15
iii. In Cortex-M Data are exchanged with memory and I/O via System Bus
iv. No need of type specifiers while writing 16-bit to memory because it is Byte-addressable
v. Occurs when PUSH operation is performed on completely filled stack Stack Overflow
[CLO2] Use C & Assembly language to program microcontroller.
A [2 Points] Write and justify the value of Diff when the following function is executed?
uint8_t Data[4] = {1,2,4,8}; Diff = Justification:
uint8_t Diff; Data[1]-Data[2] = 2-4 would seem to be -2,
void Fun3(void){ 254 but as an 8-bit unsigned number it is 254
Diff = Data[1] - Data[2];
}
[2 Points] The intent of the function Fun1is to call another function void Fun1(void){
Output with the values from 1 to 100. There is one bug. Describe and uint16_t i = 1;
B fix the bug in the code by adding, changing, or removing as necessary. while (i<=100){
Output(i);
i = i+1;
Description of bug: Missing braces to group statement }}
[1 Point] The input is a 32-bit signed value in R0, and the return value, also 32-bit signed, is in R0.
C
The intent of the function Fun2 is to return 1024*input+25. Choose best answer that describes Fun2.
Fun2 LSL R0,R0,#10 i. There is a bug on line 1, should have used ASR
ADD R0,R0,#25 ii. There is nothing wrong, it always works
BX LR iii. There is a possibility for overflow
iv. There is a bug on line 2, should have used ADDS
[CLO3] Construct basic embedded systems by Interfacing multiple sensors and actuators
with microcontrollers.
[2 Points] Interface eight switches to Port B using positive logic. For full credit, design
A the hardware/software interface that uses the fewest number of external components

[3 Points] During initialization what values (in hex) should you write into the following
B
registers? For registers you would not initialize, enter NA into the box.
RCGC2_GPIO_PORTB_R 0x02 GPIO_PORTB_DATA_R NA
GPIO_PORTB_DIR_R 0x00 GPIO_PORTB_PDR_R 0xFF
GPIO_PORTB_PUR_R NA or 0x00 GPIO_PORTB_DEN_R 0xFF

You might also like