DOC PREVIEW
PSU EE 200 - final_f13

This preview shows page 1-2-21-22 out of 22 pages.

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

Unformatted text preview:

BlankSolutionsEE 200 Final Exam 17 December 2013Last Name (Print):First Name (Print):ID number (Last 4 digits):Section:DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SOProblem Weight Score1 252 253 254 25Total 100INSTRUCTIONS1. You have 2 hours to complete thi s exam.2. This is a closed book exam. You may use one 8.5”× 11” note sheet.3. Calculators are allowed.4. Solve each part of the problem in the space following the question. If you need more space, continue your solutionon the reverse side labeling the page with the question number; for example, Prob lem 1.2 Continued. NOcredit will be given to solutions that do no t meet this requirement.5. DO NOT REMOVE ANY PAGES FROM THIS EXAM. Loose papers will not be a ccepted and agrade of ZERO will be assigned.6. The quality of your analysis and evaluation i s as important as your answers. Your reasoning must be preciseand clear; your complete English sentences should convey what you are do ing. To receive credit, you mustshow your work.1Problem 1: (25 Points)Figure 1 shows C-code for a microcontroller application.Figure 1: Microcontroller C-code21. (16 points) Based on the C-code in Figure 1, complete the function in Figure 2. For each line a code, includea short comment describing i ts purpose.void Init_DIO _ports (void) {}Figure 2: Function for initializing the DIO ports32. (9 points) In order for the voltag e on pins 5 and 3 to be VDDand VSS, respectively, what must the voltagesbe on pins 2 and 4? To receive credit you must justify your answer in a few short sentences, and, if necessary,show appropriate calculati ons.4Problem 2: (25 Points)A Moore finite state machine with input x (x = 0 or 1) and o utput yz (yz = 00, 10, or 01) is represented using thestate diagram in Fi gure 3.Figure 3: State diagramCompl ete the first switch statement in Figure 4 on page 6 so that the microcontroller realizes the Moore FSM inFigure 3.5typedef enum {S0, S1, S2} S;S s = S0;int main(void) {int x;initialize_ DIO_ports() ;while (1) {x = PORTAbi ts.RA0;switch (s) {} // end first switch statementswitch (s) {case S0: LATBbits.LATB0 = 0; LATBbi ts.LAT B1 = 0;break;case S1: LATBbits.LATB0 = 1; LATBbi ts.LAT B1 = 0;break;case S2: LATBbits.LATB0 = 0; LATBbi ts.LAT B1 = 1;break;}__delay_ms( 1000);} // end while loop} // end function mainFigure 4: Microcontroller C-code for implementing a Moore finite state machine6Problem 3: (25 Points)The C-code in Figure 5 on page 8 utilizes a hardware triggered interrupt.1. (5 points) If an interrupt is not triggered, explain the operation of the while-loop in lines 20 to 23.2. (5 points) What peripheral pin on the dsPIC33EP64MC502-I/SP triggers the interrupt? Justify your answer.3. (5 points) Based on your answer in part 2, specify the code that should be added to line 32 in the functionInit IO ports().4. (5 points) Is an interrupt triggered on the rising or falling edge of the signal applied to pin specified in part 2?Justify your answer.5. (5 points) What action does the interrupt service routine have on the digital output port?7Figure 5: Microcontroller C-code8Problem 4: (25 Points)A voltage-controlled oscillator (VCO) is an electronic oscillator whose frequency is controlled by an input voltage.The C-code on pages 10 and 11 implements a VCO using the dsPIC33EP64MC502-I/SP m icrocontroller. The analogvoltage applied to pi n 2 determines the frequency of the square-wave appearing on pin 25.1. (5 points) How often i s the frequency of the square-wave output updated? Justify your answer in one or twoshort sentences.2. (13 points) Specify an equation for PTPER in line 82 so that the output frequency ranges from 500 Hz to 10kHz as the control voltage applied to pin 2 va ries from 0 V to 3.3 V. To receive partial credit, explain yourlogic in complete English sentences and show appropriate calculations.3. (7 points) Specify an equati on for PDC1 in line 84 so that the duty cycle of the square-wave output is approx-imately 25% regardless of the square-wave frequency. To receive parti al credit, explai n your logi c in completeEnglish sentences and show appropriate calculations.910111. (16 points) Based on the C-code in Figure 1, complete the function in Figure 2. For each line a code, includea short comment describing i ts purpose.void Init_DIO _ports (void) {}Figure 2: Function for initializing the DIO


View Full Document

PSU EE 200 - final_f13

Download final_f13
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 final_f13 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 final_f13 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?