DOC PREVIEW
UT EE 345M - Final Exam

This preview shows page 1-2-3 out of 8 pages.

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

Unformatted text preview:

EE345M Final Exam Spring 2008 Page 1 of 8 Jonathan W. Valvano First Name: _______________ Last Name:____________________ May 10, 2008, 9am-12n Open book, open notes, calculator (no laptops, phones, devices with screens larger than a TI-89 calculator, devices with wireless communication). Please don’t turn in any extra sheets. (5) Question 1. If the CAN channel is noisy, it is possible that some bits will be transmitted in error. Assume there are four nodes, one is transmitting and three are receiving. What happens if a data bit is flipped in the channel due to noise being added into the channel? (5) Question 2. Assume an analog input PAD0 is being sampled in the background. Data is piped through a FIFO to a foreground thread, and there is a real-time OS with blocking semaphores. We define time-jitter, δt, as the difference between when a periodic task is supposed to be run, and when it is actually run. The goal of a real-time DAS is to start the ADC at a periodic rate, ∆t=1/fs. Let tn be the nth time the ADC is started. In particular, the goal to make tn – tn-1 = ∆t. The jitter is defined as the constant, δt, such that ∆t-δt < tn – tn-1 < ∆t+δt for all n. Consider the situation where the time jitter is unacceptably large. Which modification to the system will cause the largest improvement in time jitter? Just circle your selection. A) Run the ADC in continuous mode B) Convert from blocking semaphores to spinlock to semaphores C) Change from round robin to priority thread scheduling D) Set the ETRIG bit in ATDCTL2, and clear the ETRIGLE ETRIGP bits specifying a falling edge hardware triggered ADC. Use the PWM mode on PT3 of to create a squarewave with a period of ∆t, and connect PT3 to PAD7. E) Increase the time you run with interrupts disabled.EE345M Final Exam Spring 2008 Page 2 of 8 (15) Question 3. Consider the following motor interface. A series-wound DC motor, like the ones in the robot kit, can be modeled by a series combination of a resistor (the ohmic contribution of the long thin wires used to wrap the electromagnets), an inductor (physically resulting from the cylindrical manner in which the electromagnets are wound), and an emf (a voltage caused by the load torque applied from the shaft back into the electromagnet). The resistance is what you get when you measure the resistance of the motor with an ohmmeter (a stopped motor, disconnected from power). In this case, R = 50 Ω and L = 100 µH. Hint: L/R is 2 µsec. Part a) Under maximum load, the emf becomes –40V and about 1A flows through the motor. What transistor do you choose for this interface (specify part number)? Why? Part b) What value do you choose for Rb? Show your work using the symbols from the picture. Part c) Initially the motor is off (no current to the motor). At time t=0, the digital port goes from 0 to +5 and transistor turns on. Assume for this section, the emf is zero (motor has no external torque applied to the shaft) and the transistor turns on instantaneously, derive an equation for the motor (Ic) current as a function of time. ICVCE+-+-VBER9S12-+VOHPortIBMotor+8.4V-+RLemf-+b1N914EE345M Final Exam Spring 2008 Page 3 of 8 (20) Question 4. Consider a robot powered by two DC motors on the rear wheels, but the wheels are not perfectly matched. One wheel has more friction than the other. Experimental analysis shows the left wheel is slower than the right. The goal of this design is to go as fast as possible in a straight line. There are optical sensors on both wheels. There are an equal number of stripes on each wheel. Let NumLeft be the number of stripes counted on the left wheel. Let NumRight be the number of stripes counted on the right wheel. The approach will be to operate the left wheel at full speed and adjust the power to the right wheel so that the difference error = NumRight - NumLeft is driven to zero. If error is positive (right wheel is ahead of left wheel) then reduce power to the right wheel. If error is negative (right is behind of left) then increase power to the right wheel. cogPassiveWheelsPoweredWheelsPoweredrear wheelPassivefront wheelOpticalsensors Part a) Assume the left wheel optical sensor is connected to PT0 and the right wheel optical sensor is connected to PT1. The hardware is given. Write an initialization routine and two input capture ISRs that measure NumRight and NumLeft in the background.EE345M Final Exam Spring 2008 Page 4 of 8 Part b) Assume the left wheel motor is interfaced to PT2 and the right wheel motor is interfaced to PT3. Essentially there are two copies of the interface circuit shown in Question 3. Again, the hardware is given. You will set PT2 high and use 8-bit PWM on PT3 to adjust power to the right motor. Write an initialization routine that sets PT2=1, and initializes a 100 Hz 8-bit PWM on PT3. Write a separate function that can be called to set the duty cycle of PT3 (0 to 255). Assume a 4 MHz E clock. PT3 does not have to be exactly 100 Hz, just approximately 100 Hz. Part c) Let U be the 8-bit duty cycle to the right motor (0 to 255). Assume the time constant of the motor is 500 ms. Develop equations (using integer math) you could use to calculate U from the measured error. How often would you execute this equation? If you need some controller constants, define them as K1 K2 K3 etc., specifying the sign of the constant without specifying the actual value. Explain your rationale.EE345M Final Exam Spring 2008 Page 5 of 8 (15) Question 5. Consider the following implementation of a spinlock semaphore used with a round robin preemptive scheduler. void OS_Wait(char *semaPt){ asm sei // Test and set is atomic while(*semaPt <= 0){ // disabled asm cli // disabled asm nop // enabled asm sei // enabled } (*semaPt)--; // disabled asm cli // disabled } // enabled void OS_Signal(char *semaPt){ (*semaPt)++;} Part a) The compiler generated this code for OS_Signal 0000 b745 [1] TFR D,X 0002 6200 [3] INC 0,X 0004 3d [5] RTS Are there any critical sections in OS_Signal? I.e., can two threads both call OS_Signal? Justify your answer. Part b) Design a new op code for the 9S12, and use it to rewrite OS_Wait so the spin lock


View Full Document

UT EE 345M - Final Exam

Download Final Exam
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 Exam 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 Exam 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?