Problem Set 9
Transcription
Problem Set 9
EE 200 Problem Set 9 Cover Sheet Spring 2015 Last Name (Print): First Name (Print): ID number (Last 4 digits): Section: Submission deadlines: • Problems 33 will be graded in 302 EE West. Each student must demonstrate a solution. Every student must sign up for a single ten minute grading session from 6:30 pm to 8:30 pm on either Monday April 20 or Tuesday April 21. You must sign up for a ten minute slot using SignUpGenius. You will receive notification via email when an on line sign up sheet is posted. • Each EE 200 student must complete the circuit in problem 34 prior to attending Laboratory #24. At the beginning of the laboratory section, each student must show the completed circuit to the instructor to receive a grade for problem 34. • Each EE 200 student must complete the circuit in problem 35 prior to attending Laboratory #25. At the beginning of the laboratory section, each student must show the completed circuit to the instructor to receive a grade for problem 35. Problem Weight 33 50 34 25 35 25 Total 100 Score Problem 33: (50 points) Each EE 200 student must realize the finite state machine for the garage door controller in the solution for Problem Set 3 Problem 9 using the dsPIC33EP64MC502 microcontroller, and demonstrate their circuit to the laboratory instructor during the grading session on either Monday April 20 or Tuesday April 21 from 6:30 pm to 8:30 pm in 302 EE West. To earn full credit you must follow the instructions below. 1. Implement the FSM in C using Exercise 3 in Laboratory #16 as a guide. 2. Realize the finite state machine using nested switch statements within a while-loop as discussed in Laboratory #16. The inner switch statements act on the values of the inputs T , B, P , and C. 3. As for the realization using LabVIEW in Problem Set 7 Problem 25, simplify the code by using the fact that regardless of the present state, each inner switch statement selects between two cases. 4. Set the clock period to 2 s, that is, every two seconds read the digital input signals T , B, P and C, and set the next state accordingly. 5. Implement an asynchronous reset using interrupt INT1. Pressing the reset button R must trigger an interrupt that immediately sets the state to SO and the outputs U and D accordingly. 6. Use the signal assignments in Table 1. Signal Designation T B P C R U D Signal Description top bottom photodetector control asynchronous reset raise door lower door Microcontroller I/O designation RA0 RA1 RB0 RB1 RPI34 RB11 RB10 Pin Number 2 3 4 5 6 22 21 Table 1: The microcontroller Digital I/O assignments. 7. Use four tactile switches to generate the inputs T , B, P , and C, and a wire, or fifth tactile switch to generate R. To reduce the possibility of electrical noise generating an erroneous input to the microcontroller, connect the five corresponding digital lines to VDD through a 27 kΩ resistor, and use a switch to pull the logic level low when a button is pressed. Keep in mind that the inputs T , B, C, and R transition to a logical high state when the corresponding button is pressed, while the signal P should go to a logical low state when the tactile switch representing P is pressed. 8. Use red and green LEDs to indicate the output signals D and U , respectively, where a lit LED indicates a logic-high signal. For each LED, limit current using a 330Ω series resistor. 9. Clearly label the tactile switches that represent the control signals T , B, P and C, and the LEDs that represent the output signals U and D. Also label the wire or tactile switch representing the reset input R. During the project demonstration, the instructor will award points using the following criteria. 1. (5 points) Clearly label the tactile switches that represent the control signals T , B, P and C, and the LEDs that represent the output signals U and D. Also label the wire or tactile switch representing the reset input R. 2. (5 points) Show the C code to the instructor and demonstrate that you can compile and down load the code to the microcontroller. 3. (16 points) Show that the C code uses nested switch statements to realize the finite state machine, and that each inner switch statement considers only two cases. 4. (12 points) Demonstrate that pressing the reset button triggers an interrupt that returns the system to state S0 and appropriately sets the outputs. 5. (12 points) Demonstrate that system responds correctly to the inputs T , B, P and C. Problem 34: (25 points) A goal of Laboratory #24 is to use the dsPIC33EP64MC502 microcontroller to regulate the intensity of an an LED using pulse width modulation (PWM) where a potentiometer determines the percent duty cycle. In this exercise the LCD module provides a way to display the potentiometer output voltage and the PWM duty cycle. In addition to the microcontroller power and interface circuit in Figure 1, assemble the circuit in Figure 2 prior to attending Laboratory #24, as it is required to complete the laboratory exercises. Figure 2 also identifies pin 1 on the LCD module connector. At the beginning of Laboratory #24, the instructor will quickly check to see if each student in the section has completed this task. Figure 1: Basic connections for all EE 200 microcontroller projects. Figure 2: Additional microcontroller connections for Laboratory #24. Problem 35: (25 points) One goal of Laboratory #25 is to demonstrate the use of the Consumer/Producer design pattern with an event structure and the use of coding standards to develop a LabVIEW project that writes text to the LCD module. To achieve this goal, please bring the circuit in Figure 3 to Laboratory #25. At the beginning of Laboratory #25, the instructor will quickly check to see if each student in the section has completed this task. Figure 3: Laboratory #25 myDAQ schematic.