DOC PREVIEW
U of U ECE 3720 - Midterm Exam Problems
Pages 7

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

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 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 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS/EE 3720Spring 2004MyersMidterm 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. Semaphores (25 points)The spin-lock semaphore implementation in Program 5.8 on page 276 requires interrupts to betemporarily disabled while the semaphore S is being read and modified. Assume the existenceof a new test-and-set instruction, tset. Using this instruction and a new lock variable, wecan te st that the lock is 0 and set it to 1 in one atomic operation. If the test finds that thelock is already 1, then it will clear the carry bit in the condition code register to indicate afailure. Otherwise, the carry bit will be set to 1. This new instruction allows us to implementwait and signal without disabling interrupts as follows:S fcb 1lock fcb 0wait tset lock sets carry to 1 if lock is successfully set to 1bcc waitloop ldaa Sbhi OKbra loopOK decastaa Sclr lockrtssignal tset lockbcc signalinc Sclr lockrts(a) The code ab ove, unfortunately, can result in a deadlock. Give a detailed example demon-strating how deadlock can occur.(b) This problem can be eliminated by making a small modification to the code above. Showthe modification on the above code.2. Input Capture, Output Compare, and Serial I/O (50 points)In this problem, you will use input capture and output compare to construct an SCI interface.A block diagram for this interface is shown below. Assume a baud rate of 1000 bits/s. Yourinterface should provide both transmit and receive functionality. You can assume the existenceof the subroutines InitFifo, PutFifo, and GetFifo. InitFifo has no parameters and you canassume that it will save and restore any registers that it uses. PutFifo puts the 8-bit data inRegA into the FIFO. GetFifo takes a pointer in RegX to the place to put the 8-bit data takenfrom the FIFO. The main program (which you do not need to provide) will extract ASCIIcharacters from the RxFIFO, and it will put ASCII characters into the TxFIFO. In the caseof transmission, you can assume that it will arm an output compare interrupt handler to startthe transmission.6811PA1/IC2PA5/OC3RS232serial(a) Draw the output signal when the ASCII character ’A’ (41 in hex) is transmitted. Assumethat TCNT is 2000 (decimal) at the start of transmission. Give the TCNT value foreach transition of the output signal. Place arrows on the drawing to indicate where theIC and OC interrupts will occur, giving the TCNT value at each interrupt. Do the samething for when an ’A’ is received.(b) Define all needed global variables.(c) Show the ritual that initializes the global variables, input capture, and output compareinterrupts.(d) Show the input capture and output compare interrupt handlers.Extra page for problem 2Extra page for problem 23. Input Switches (5 points)You want to debounce a switch with a capacitor. Assume a bounce time of 3 ms and thatyou are using a 2 KΩ pullup resistor. Be sure to show all calculations.(a) What capacitance value should it have?(b) Due to this capacitor, how long will the signal spend in the transition region (0.7v to2v) when it is rising?4. Output LEDs (20 points)You would like to construct a bright 2 character LED display. To make it bright, assume adesired current of 20mA through the LED. You may use any figures or tables from Chapter8 necessary to answer the following questions. Assume characteristics for RED LEDs apply.(a) Draw a schematic for the display. Label all parts including values for resistances (showcalculation).(b) What are the maximum number of digits that you can extend this display to? Why?What would the maximum peak forward current and maximum power be for this largerdisplay? How much time would be available to display a single


View Full Document

U of U ECE 3720 - Midterm Exam Problems

Course: Ece 3720-
Pages: 7
Download Midterm Exam Problems
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 Midterm Exam Problems 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 Midterm Exam Problems 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?