DOC PREVIEW
PSU EE 200 - final_f14

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 16 December 2014Last 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. Relevant excerpts from the microcontroller datasheet and LCD handouts are provided in a separate documentaccompanying the exam.4. Calculators are allowed.5. 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.6. DO NOT REMOVE ANY PAGES FROM THIS EXAM. Loose papers will not be a ccepted and agrade of ZERO will be assigned.7. The quality of your analysis and evaluation i s as important as your answers. Your reasoning must be preciseand clear; your complete sentences should convey what you are doing. To receive credit, you must showyour work.1Problem 1: (25 Points)1. (8 points) Figure 1 shows the pin out diagram for the dsPIC33EP64MC502-I/SP microcontroller while Figure1shows a partially completed function for assigning functions to the peripheral pins. Compl ete the code inFigure 2 so that(a) Pin 2 can be used for digital input.(b) Pin 3 can be used for digital output.(c) Pins 4 and 5 can be used for analog input.Figure 1: Pin o ut diagram of the dsPIC33EP64MC502-I/SP microcontroller.Figure 2: C function for assigning functions to the peripheral pi ns.22. (7 points) Pins 9 through 11 of the dsPIC33EP64MC502-I/SP microcontroller are configured for digital input.Pins 9 (RA2) and 11 (RB4) are tied to 3.3 V, while pin 10 (RA3) is tied to 0 V. Determine the numeric valueof x after the code in Fi gure 3 executes.Figure 3: C code for Problem 1 Part 2.33. (10 points) Pin 7 (RB3) has been configured for di gital input and has been tied to to 0 V. Determine the valuesof x and y after the C code in Figure 4 executes.Figure 4: Code for Problem 1 Part 3.4Problem 2: (25 Points)The C code in Figure 5 on page 6 realizes a Moore finite state machine. The input to the finite state machine isappli ed to pin 2 (RAO) while the output of the finite stare machine appears on pin 3 (RA1).1. (12 points) Complete the state table in Fig ure 1, where the variable input is defined in li ne 48 of the code andthe variable output refers to the logic level of pin 3 (RA1).Present Next State OutputState input = 0 input = 1 RA1S0S1S2S3Table 1: State table for Problem 2.5Figure 5: Code for realizing a Moore finite state machine.62. (6 points) The finite state machine in Figure 5 requires an asynchronous reset that places the system in stateS0 whenever there is a rising edge on the digital input connected to pin 5. Complete lines 28 and 29 in theinterrupt initialization code shown in Figure 6.Figure 6: C function for initializing the interrupt.3. (7 points) In com parison to polling, describe the advantages that interrupts provide when implementing anasynchronous reset for a finite state machine realized using a microcontroller.7Problem 3: (25 Points)A dsPIC33EP64MC502 -I/SP m icrocontroller generates a PWM output signal with a duty cycle determined by arotary incremental quadrature encoder. The mechanical encoder generates 18 counts per revolution, and connectsto pins 6 and 7 of the microcontroller. As each count commanded by the encoder produces 4 counts in the dsPIC33counter, one revolution of the encoder produces a maximum count per revolution (MCPR) of 18 × 4 − 1 = 71. ThePWM output signal appears on pin 25 of the microcontroller. Figure 7 shows the C function for initializing thequadrature encoder interface (QEI) module of the microcontroller.Figure 7: Code for initializing the QEI module.1. (8 points) Complete line 45 of the code in Figure 7 so that pins 6 and 7 are assigned to the quadrature inputssignals QEA and QEB, respectively. To receive parti al credit, show work below.2. (9 points) Complete lines 46 through 49 in the code so that two f ull rotations of the mechanical encoder causethe posi tion counter register, PSO1CNT, to reset to zero. To receive partial credit, show work below.83. (8 points) The PWM output on pin 25 is connected to ground through a 3.3 kΩ. Assume that the logical highoutput voltage is 3.3 V and the duty cycle is 75%.(a) (3 points) Determine the average current through the 3.3 kΩ resistor.(b) (5 points) Determine the average power dissipated by the 3.3 kΩ resistor.9Problem 4: (25 Points)1. (13 points) Figure 8 completed C functions for reading an ana log voltage using the dsPIC33EP64MC502-I/SPmicrocontroller.Figure 8: C functions for sampling an a nalog voltage.(a) (3 points) Specify the pin number of the dsPIC33EP64MC502-I/SP microcontroller to where the analioginput must be connected.(b) (4 points) Why is it necessary to include line 21 in the function Init ADC?(c) (6 points) Complete line 33 in the code so that the value of X takes on +10 when the analog input voltageis3.3 V, and 0 when the analog i nput voltag e is 0 V.102. (12 points) Using the C code developed in Exercise 2 of Laboratory #24, complete the code in Figure 9 toobtain the message appearing in Figure 10Figure 9: C functions for writing a message to the LCD module.Figure 10: LCD module display.11EE 200 Final Exam 16 December 2014Last 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 this exam.2. This is a closed boo k exam. You may use one 8.5”× 11” note sheet.3. Relevant excerpts from the microcontroller datasheet and LCD handouts are provided in a separate documentaccompanying the exam.4. Calculators are allowed.5. Solve each part of the problem in the space fol lowing the question. If you need more space, continue your solutionon the reverse side labeling the page with the question number; for example, Problem 1.2 Continued. NOcredit will be given to solutions that do no t meet this requirement.6. DO NOT REMOVE ANY PAGES FROM THIS EXAM. Loose papers will not be accepted and agrade of ZERO will be assigned.7. The quality of your analysis and evaluation i s as important as your answers. Your reasoning must be preciseand clear; your complete sentences should convey what you are doing.


View Full Document

PSU EE 200 - final_f14

Download final_f14
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_f14 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_f14 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?