Department of Electrical & Computer Engineering (ECE)
North South University
Course Code: 331,
Course Title: Microprocessor Interfacing & Embedded System
Final Exam Fall 2021
Time: 90 Minutes Marks: 30
Name:
Student ID and section:
Please read the questions very carefully and answer accordingly. All the answers should be written in
the answer script that has been provided. Calculators/pens/pencils are allowed. You must surrender
any textbook/notebook/cell-phone. Adopting any unfair means during the exam will automatically
result in expulsion without any prior/post notice. You must return back your question paper with your
answer script. Answer 2 out of the 3 sets of the questions given. Clearly indicate the number of the
questions being answered (Example: Answer to the question: 3 (a)(i)
1. Answer all the questions given below
(a) Explain how to access and configure individual bit as input for 8051 application.
[2.5+2.5]
(b) Consider the following 8051 interfacing problem. Crystal frequency: 11.059MHz.The
relay coil is to be energized at an interval of 10 ms. Use timer routine to implement the
operation. [1+1+1+1+1]
i) Initialize TMOD for timer 0 , mode 1 operation
ii) Initialize TH0 and TL0 for 10 ms delay
DMH (Microprocessor) 1
iii) Construct the delay loop with appropriate timer flag setting
iv) Access and configure relevant pin as needed
v) Call back delay loop from the main function as needed
2. Answer all the questions given below
(a) Explain the difference between edge triggered and level triggered interrupt by sketch.
Where the starting address of the memory location of every interrupt is stored?
[2.5+2.5]
(b) Consider the following 8051 interfacing problem. Crystal frequency: 11.059MHz. The LED
D8 will light up with every key press as shown below. [1+1+1+1+1]
i) Initialize IE register for external interrupt at INT0
ii) Initialize TCON register for the appropriate type of interrupt
iii) Declare and define the interrupt service routine
iv) Access and configure relevant pin as needed
DMH (Microprocessor) 2
v) Call back action in the main function as needed
3. Answer all the questions given below
(a) What are the two main steps for analog to digital conversion? Show that the
quantization error increases as the range of voltage levels to be sensed increases. Use 3
bit ADC as an example [2.5+2.5]
(b) Consider the following 8051 interfacing problem. [1+1+1+1+1]
The delay between consecutive analog to digital conversion will be dynamically adjusted. If
the analog reading (Vanalog) goes >= VCC/2, delay is 40 ms while if goes <VCC/2 , delay is 20 ms
i. Initialize the digital reading input port of 8051
ii. Define and configure WR, RD and INTR pins
iii. Define ADC routine
DMH (Microprocessor) 3
iv. Call back delay function in ADC routine as needed. The off time for WR is 10
ms as shown below
v. Conditional call back in main function as determined from the analog to digital
code conversion equation given below. You can use global variable
Hints:
-function to create required delay
void delay(unsigned int msec ) // Delay function
inti,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
- Equation to derive analog value read
Vanalog= ADC code *LSB in decimal
Full scale = 5V
N=8 bits
LSB= Full scale/2N
N=8
Full scale=5-0=5 (for 5V VCC)
ADC code: 0000 0000 to 1111 1111 in binary
DMH (Microprocessor) 4