Embedded Systems Midterm

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

ECOM 4422 Embedded Systems Prof. Ibrahim S. I.

Abuhaiba
2nd Semester, 2022/2023 Computer Engineering Department
Midterm Exam Faculty of Engineering
60 Minutes Islamic University
Open Paper Textbook Gaza, Palestine
Student's Name: Student's ID:
Keep with you only the paper textbook, and stationary.
Close all communication devices.
Put near the whiteboard all communication devices, laptops, bags, and other things.
Answer in English.
After you submit the answer sheet, take the problem sheet with you.

Problem One (10 points)


What is the most appropriate ISO C99 data type required to represent your university number? Justify.

Solution:
Selected data type must be:
Unsigned: since university number can’t be negative.
With smallest range that includes the maximum possible university number, which is 299999999, since
university numbers consist of 9 decimal digits where the maximum leftmost digit is 2 and remaining 8 digits
may reach 99999999. This saves memory.

The most appropriate ISO C99 data type that satisfies the above constrains is uint32_t. It is unsigned, has a
size of 4 bytes, and has a range from 0 to 4,294,967,295.

Problem Two (10 points)


Write a single C statement, using Keil MDK-ARM syntax, to enable clock of port A and disable clock of port
E without affecting clocks of other peripherals.

Solution:
Mask to enable clock of port A = 0x2000
Mask to disable clock of port E = 0xDFFF = ~0x2000
SIM->SCGC5 = (SIM-> SCGC5 | 0x200) & ~0x2000;

Problem Three (10 points)


For a 20×4 LCD, find the address command required to move the cursor to the 15th location of third line,
assuming that the leftmost position of a line is the first location of that line.

Solution:
Distance between 15th location and 1st location = 15 – 1 = 14 = 0xE
Address command of first location of 3rd line = 0x94.
Address command of the 15th location = 0x94 + 0xE = 0xA2.
Problem Four (10 points)
Assume asynchronous communication is used with one stop bit and odd parity. Draw the frame required to
send a character whose ASCII code is 0x42.

Solution:

0 1 1 0 1 0 0 0 0 1 0 0 1
Space Stop Parity D7 D6 D5 D4 D3 D2 D1 D0 Start mark

Problem Five (10 points)


Calculate the maximum delay that can be achieved using the low power timer (LPTMR) of ARM KL25Z.
Assume that the source clock is 32.768 KHz.

Solution:
Counter clock frequency = system clock / prescalar = 32.768 × 103 / 65536 = 0.5 Hz
One count period = 1 / Counter clock frequency = 1 / 0.5 = 2 sec.
Maximum delay = One count period × (maximum MOD value + 1) = 2 × 65536 = 131072 secs
= 2184.53 mins
= 36.41 hours
= 1.517 days

You might also like