UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III

Similar documents
UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz III

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz V

Context Switching & Task Scheduling

AVR Timers TIMER0. Based on:

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs)

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut

ECGR 4101/5101, Fall 2015: Lab 7 Digital Oscilloscope

FACULTY OF ENGINEERING LAB SHEET

Marten van Dijk, Syed Kamran Haider

ADC: Analog to Digital Conversion

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

C Language Programming, Interrupts and Timer Hardware

AVR Board Setup General Purpose Digital Output

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

C Language Programming, Interrupts and Timer Hardware

YOU WILL NOT BE ALLOWED INTO YOUR LAB SECTION WITHOUT THE REQUIRED PRE-LAB.

Embedded Systems and Software

Timer 32. Last updated 8/7/18

EEPROM Watchdog Timer

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

Software debouncing of buttons

MEDIS Module 2. Microcontroller based systems for controlling industrial processes. Chapter 4: Timer and interrupts. M. Seyfarth, Version 0.

Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA

Final Exam. Date: May 12, 2017

COMP 7860 Embedded Real- Time Systems: Threads

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

6.033 Computer Systems Engineering: Spring Handout 13 - Quiz I THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. NO PHONES, NO LAPTOP, NO PDAS, ETC.

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Operating System Engineering: Fall 2003

CSCE374 Robotics Fall 2013 Notes on the irobot Create

QUIZ How do we implement run-time constants and. compile-time constants inside classes?

SYSTEM DESIGN SPECIFICATIONS ZIGBEE BASIC SYSTEM

Rochester Institute of Technology CMPE 663/EEEE 663 Graduate Student Project

Lab Overview. Lab Details. ECEN 4613/5613 Embedded System Design Week #7 Spring 2005 Lab #4 2/23/2005

FINAL EXAM. last name first name

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts

Task Based Programming Revisited Real Time Operating Systems

ECEN 5613 Embedded System Design Week #9 Spring 2017 Lab #4 3/20/2017

Microcontroller & Interfacing

Embedded Systems and Software

University of Florida EEL 3744 Spring 2018 Dr. Eric M. Schwartz. Good luck!

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Quiz II

6.033 Computer Systems Engineering: Spring Quiz I THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. NO PHONES, NO COMPUTERS, NO LAPTOPS, NO PDAS, ETC.

Physics 120B: Lecture 11. Timers and Scheduled Interrupts

EE251: Thursday November 30

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

Interrupts. Embedded Systems Interfacing. 08 September 2011

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */

ENGR 40M Project 3c: Coding the raindrop pattern

CSCE 436/836: Embedded Systems Lab 1b: Hoverboard Programming Introduction

Laboratory 3 Working with the LCD shield and the interrupt system

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts. How can we synchronize with a peripheral? Polling

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Lab 02 Arduino 數位感測訊號處理, SPI I2C 介面實驗. More Arduino Digital Signal Process

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia

Unit 13 Timers and Counters

CS 151 Midterm. Instructions: Student ID. (Last Name) (First Name) Signature

Lab 7: Creating a Virtual Pet

Corso di Elettronica dei Sistemi Programmabili

UNCA CSCI 255 Exam 3 Fall 2011

CprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing. Instructors: Dr. Phillip Jones Dr.

Laboratory 10. Programming a PIC Microcontroller - Part II

CS164: Midterm I. Fall 2003

Lecture 5: MSP430 Interrupt

CSE 5A Introduction to Programming I (C) Homework 4

Lab 9: On-Board Time Generation and Interrupts

Analog Output with a Digital to Analog Converter

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2

GE420 Laboratory Assignment 3 More SYS/BIOS

Introduction to Embedded Systems

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2008 Quiz II

In Class Assignment 2

Lab 3a: Scheduling Tasks with uvision and RTX

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz 2

Real Time Operating System: Inter-Process Communication (IPC)

Embedded Software TI2726 B. 4. Interrupts. Koen Langendoen. Embedded Software Group

Using the KD30 Debugger

Mark Redekopp, All rights reserved. EE 357 Unit 10b. Interrupts Timers

AGH University of Science and Technology Cracow Department of Electronics

Laboratory 4 Usage of timers

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

ECE 271 Microcomputer Architecture and Applications University of Maine

The University of Texas at Austin CS 372H Introduction to Operating Systems: Honors: Spring 2012 Midterm Exam

Lab Course Microcontroller Programming

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

NCSU - ECE 306- Exam 2 March 27, 2003

Microcontroller and Embedded Systems:

Lab 3e LCD Alarm Clock

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

Transcription:

Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Lab Test III There are 2 longer programming problems in this test. There are 6 pages in this booklet. Answer each question according to the instructions given. You have 100 minutes to answer the questions. Once you are done, you need to show the output to the Instructor or TA and e-mail the code to the TA. Some questions are harder than others and some questions earn more points than others you may want to skim all questions before starting. If you find a question ambiguous, be sure to write down any assumptions you make. Be neat and legible. If we can t understand your answer, we can t give you credit! Write your name in the space below. Write your initials at the bottom of each page. THIS IS AN OPEN BOOK, OPEN NOTES TEST. YOU CAN USE YOUR LAPTOP BUT PLEASE TURN YOUR NETWORK DEVICES OFF. Any form of communication with other students is considered cheating and will merit an F as final grade in the course. Do not write in the boxes below 1 (x/60) 2 (x/40) 3 (x/60) Total (xx/160) Name: Student ID:

ECE 3411 Fall 2015, Quiz Page 2 of 6 1. [60 points]: a. Write a C program for your AVR that performs the following functions: It always blinks an LED at a constant frequency of 1Hz with 50% duty cycle. It is always ready to receive characters over UART and as soon as a character is received, it echoes/prints it back to the Terminal immediately without waiting for a return key ( \r ) or a next line character ( \n ). Once a return key ( \r ) or a next line character ( \n ) is received, it converts all the characters received so far (since last \r or \n ) to lower caps and prints them on the Terminal. E.g. A becomes a, whereas b remains b and so on. b. Extend Task1(a) such that your code now prints the received characters on the Terminal over UART as well as on the LCD. The first row of the LCD should be used to immediately print the received characters without waiting for a return key ( \r ) or a next line character ( \n ). The second row of the LCD should be used to print all the characters received so far (since last \r or \n ) converted to lower caps. It should still always blink an LED at a constant frequency of 1Hz with 50% duty cycle. c. Extend Task1(b) such that now you can choose to print the received characters either on UART or on LCD based on a push switch. Upon startup, the characters are printed on Terminal over UART. A button push toggles the printing between LCD and UART. Notice that a single button push must only toggle the printing mode once. It should still always blink an LED at a constant frequency of 1Hz with 50% duty cycle.

ECE 3411 Fall 2015, Quiz Page 3 of 6 2. [40 points]: In this task, you ll use the LCD as a small billboard for displaying (printing) different advertisements. The advertisement strings that need to be displayed are stored in the program memory and are as follows: const uint8_t Google[] PROGMEM = "I am Google"; const uint8_t Intel[] PROGMEM = "I am Intel"; const uint8_t Microsoft[] PROGMEM = "I am Microsoft"; const uint8_t IBM[] PROGMEM = "I am IBM"; const uint8_t NVIDIA[] PROGMEM = "I am NVIDIA"; Using Timer0, implement a system that: Prints a new advertisement string on the first row of the LCD every second. The order in which the strings are printed should be as follows: (a) Intel (b) IBM (c) NVIDIA (d) Google (e) Microsoft Note: You are not allowed to use delay ms()/ delay us() function calls. Hint: You can use blocking LCD functions from the LCD library for this task.

ECE 3411 Fall 2015, Quiz Page 4 of 6 3. [60 points]: In this task, we are going to measure the wasted time (in milliseconds) due to blocking function calls, and then demonstrate how non-blocking functions avoid such wastage. A layout of the code that measures and prints the wasted time is provided on the next page. Notice that you are only allowed to use Timer0 for this task, and delay ms()/ delay us() function calls are not allowed (except for the ones already present in lcd lib.c). a. (15 points) Extend the provided C code layout to implement the following functionality using Timer0: Toggle a LED after every 1 second. Call the print difference() function every 10 seconds. This function prints over UART the milliseconds wasted (if any) in toggling the LED. b. (15 points) Extend Task(a) to implement the following functionality using Timer0: Issue a blocking LCD refresh request after every 1 second. The LCD refresh request simply moves the cursor to position (0,0) and prints a character different than previous one. Call the print difference() function every 10 seconds. This function now prints over UART the milliseconds wasted (if any) in refreshing the LCD using blocking functions, and toggling the LED. Hint: The LCD library functions are blocking. c. (30 points) Extend Task(a) to implement the following functionality using Timer0: Issue a truly non-blocking LCD refresh request after every 1 second. The LCD refresh request simply moves the cursor to position (0,0) and prints a character different than previous one. Call the print difference() function every 10 seconds. This function now prints over UART the milliseconds wasted (if any) in refreshing the LCD using non-blocking functions, and toggling the LED. Hint: An extended state machine for non-blocking LCD writes could help. Note: If you are unable to solve part (a), you may ask for its solution from the TA in order to make progress with part (b) and (c). However, if you do so, you will get zero credit for part(a) and only 80% credit at max for both part (b) and (c).

ECE 3411 Fall 2015, Quiz Page 5 of 6 Provided code layout to measure timing: volatile int ctr1 = 0; volatile int ctr2 = 0; volatile uint8_t ctr1_flag = 0; // Timer 0 Compare Match A ISR ISR (TIMER0_COMPA_vect) ctr2++; // Increment counter 2 ctr1_flag = 1; // Set the flag for counter 1 /* Your code for ISR goes here */ // Prints the difference of two counters over UART void print_difference() stop_timer0(); // Stop Timer 0 by clearing prescaler bits to zero printf("%i \n", ctr2 - ctr1); // Printing the difference ctr1 = 0; ctr2 = 0; // Reseting the counters start_timer0(); // Start Timer 0 by setting selected prescaler. int main(void) initialize_all(); // Initialize everything sei(); // Enable global interrupts while(1) /* Here issue a LED Toggling/LCD Refresh request every second */ /* Incrementing counter 1 */ if(ctr1_flag == 1) ctr1++; ctr1_flag = 0; /* Here call the print_difference() function every 10 seconds */

ECE 3411 Fall 2015, Quiz Page 6 of 6 End of Quiz Please double check that you wrote your name on the front of the quiz.