Final Exam Microprocessor Fundamentals 2020 Part 2
Final Exam Microprocessor Fundamentals 2020 Part 2
Student Name:________________________________________
Outcome Assessment
1|Page
Final Exam 4/28/2020
EET306 Microprocessor Fundamentals
Grambling State University 2|Page
Instructions: Work all problems in the space provided. Please show your steps for full credit. (Please see
assignment solutions posted on canvas.
4
2. Find ℒ -1 [s2 +16
3. Reduce the block diagram using the techniques disused in this course
Ein + Ein
70 0.4 35
-
25
4. Reduce the block diagram using the techniques disused in this course
+ + 5 Ein
Ein
10
- -
20
0.7
2|Page
Final Exam 4/28/2020
EET306 Microprocessor Fundamentals
Grambling State University 3|Page
5. For the following design, modify the code to implement the timer interrupt for Timer 2 for 20ms.
Implement code in the ISR to toggle output pin 13 is the input pin 2 is low. The attached code1 is an
example that uses all three timers of the Arduino
VCC
5.0V
R1
S1
P2 10kΩ
Key = Space
P13 R2
LED1
330Ω
Insert your Timer setup code and Interrupt Service Routine code below
3|Page
Final Exam 4/28/2020
EET306 Microprocessor Fundamentals
Grambling State University 4|Page
6. Use inline assembly to generate a square wave with a 75% duty cycle. (75% of period on and 25% of
period on). The frequency of this square wave should be the number of letters in your first name
multiplied by 10KHz. For example for lane, the square wave frequency should be 40KHz. The sample
program is presented below for approximately 1Hz square wave (one cycle per second). For your code
you need to have two separate delay functions, one for on and one for off. (Remember period= 1/freq,
On time = 0.75 x period, offdelay =0.25 x period)
• delay: is used as a label. The instructions that follow are used to implement a on
second delay.
• dec r8 is used to subtract 1 form r8. brne delay implements the following:
branch if r8 is not equal to zero. (subtracting 1 from 0 results in the following, 0,
254, 253,...1 ,0) go to delay label. After this is repeated 255 times and r8 becomes
equal to 0, then
• dec r9 decrements r9 by one. brne delay then directs the pointer to go to label
delay is r9 is not equal to zero.
• The process is repeated for r16 which has been preloaded with 40 so it takes
less cycles t get to zero.
• The delay function uses three nested loops to implement a one second delay.
dec r8 takes one clock cycle to execute. brne delay takes 2 clock cycles to execute.
This results in 255x255x40 = 2601000 iterations of 3 clock cycles. If a clock
frequency of 16MHz is assumed, we can calculate the delay. 2601000 x 3 x
(1/16MHz) = 0.487 seconds.
• ret is used to return the subroutine.
4|Page
Final Exam 4/28/2020
EET306 Microprocessor Fundamentals
Grambling State University 5|Page
//timer interrupts
//by Amanda Ghassaei
//June 2012
//https://www.instructables.com/id/Arduino-Timer-Interrupts/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
*/
//timer setup for timer0, timer1, and timer2.
//For arduino uno or any board with ATMEL 328/168.. diecimila, duemilanove, lilypad, nano, mini...
//storage variables
boolean toggle0 = 0;
boolean toggle1 = 0;
boolean toggle2 = 0;
void setup(){
//set pins as outputs
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);
cli();//stop interrupts
sei();//allow interrupts
}//end setup
6|Page
Final Exam 4/28/2020
EET306 Microprocessor Fundamentals
Grambling State University 7|Page
void loop(){
//do other things here
}
7|Page