DOC PREVIEW
U of U CS 5780 - CS 5780 Midterm Exam 2

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE/CS 5780/6780Spring 2007MyersMidterm Exam 2• Fill in your name:• This exam is open book and open notes.• The exam is 80 minutes and worth 100 points.• Show all your work.Question Score1234Total1. Threads/Semaphores (24 points)In lab 6, you implemented a preemptive scheduler in which each thread would periodicallyattempt to obtain a shared resource which is protected using a semaphore.(a) How is a non-preemptive scheduler different? What would have been an advantage ofusing a non-preemptive scheduler? What is a disadvantage?(b) How is a priority scheduler different? What would have been an advantage of using apriority scheduler? What is a disadvantage?(c) How is a fixed scheduler different? What would have been an advantage of using a fixedscheduler? What is a disadvantage?(d) If your ONLY goal is to have the CPU waste as little time as possible changing threadsand executing cycles on blocked threads, which scheduler (preemptive, non-preemptive,priority, or fixed) do you think would be best and briefly explain how you would achievethis goal using this scheduler.2. Timing Generation and Measurements (30 points)In lab 7, you wrote code to measure the frequency of a waveform using an input capture tocount edges and an output compare to measure the time period over which you counted edges.In this problem, you are to implement frequency measurement using the pulse accumulator tocount edges and an output compare to measure the time period over which you count edges.The main code will call a ritual to start the frequency measurement which will then continueindefinitely. Your output compare handler should copy the current frequency into a globalvariable freq and setup for the next frequency measurement.(a) Write the code for the ritual.(b) Write the code for the output compare interrupt handler.3. Serial I/O (21 points)In lab 8, you implemented a simple bus network using SCI. The problem with a bus networkis that collisions can occur and must be detected and avoided. A ring network as shown inthe figure below eliminates the problem of collisions, but it is still possible for one bad mi-crocontroller to completely bog down the network. For example, assume that microcontroller(1) continuously sends packets to microcontroller (4) (or even worse to itself).6812 681268126812TxD RxDTxDRxDTxDRxDRxDTxD(1) (2)(4)(3)(a) In this scenario, what happens if microcontroller (2) always prioritizes forwarding packetsover sending out of its own packets?(b) In this scenario, what could happens if microcontroller (2) always prioritizes sending outof its own packets and buffers incoming packets until it has nothing to send?(c) Explain how the network above could be modified to deal with this problem? Be sureto show any new connections that are required on the figure above. Assume that youcannot add another SCI port.4. Parallel I/O (25 points)In lab 9, you designed a stepper motor interface in which you sent a sequence of codes tomove the motor. It is also possible to use a stepper moter as a shaft encoder.(a) Draw a schematic showing how you connect a stepper motor to your microcontrollerwhen it is used as a shaft encoder. You may include Figure 8.91 as a component in yourschematic, but you must indicate which ports you are connecting this component to.(b) Explain in words how you would desi gn software to determine the net number of steps(clockwise steps minus counterclockwise steps) that the shaft has moved from the initialposition. Be sure to mention which interrupt handlers will be implemented and whatthey will


View Full Document

U of U CS 5780 - CS 5780 Midterm Exam 2

Documents in this Course
Lab 1

Lab 1

5 pages

FIFOs

FIFOs

10 pages

FIFOs

FIFOs

5 pages

FIFO’s

FIFO’s

12 pages

MCU Ports

MCU Ports

12 pages

Serial IO

Serial IO

26 pages

Load more
Download CS 5780 Midterm Exam 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS 5780 Midterm Exam 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 5780 Midterm Exam 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?