Exam 1 Fall 09 - Name Section 1 ‐ M Th 12‐2:50pm Section 2 ‐ M Th 3‐5:50pm Section 3 ‐ Tu F 8‐10:50am Section 4‐ Tu F 11am‐2pm

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Name:_______________________________________________ Section 1 ‐ M, Th 12‐2:50pm Section 2 ‐ M, Th 3‐5:50pm Section 3 ‐ Tu, F 8‐10:50am Section 4‐ Tu, F 11am‐2pm Section #: Professor: Grading TA: Side: ______________________________ ______________________________ ______________________________ A or B (Circle One) Laboratory Introduction to Embedded Control Exam #1 – Fall 2009 90 minutes (3 hours total for both parts) Question Earned Points Grader 1 a 4 1 b 4 1 c 5 1 d 3 2 a 3 2 b 5 2 c 6 3 a 3 3 b 3 3 c 3 3d 4 3e 7 TOTAL Max Points 50 1 Name:_______________________________________________ Problem #1 a) Using the diagram above, number the pins of the 74LS00 (pinout diagrams attached on the last page of this exam). Also, number the pins coming out of the C8051 EVB connector. b) Using the diagram below, draw the wire connections between the components as shown in the diagram above. Be sure to label the pins as well. 2 Name:_______________________________________________ c) Find the value of RD necessary to make voltage at P1.3 1.3V. Assuming 8‐bit A/D conversion is being used, determine the output of the A/D converter. Express the answer in both decimal and hexadecimal form. RD Decimal Hexadecimal d) Find the binary value if the following expression is performed on ad_result. ad_result = (ad_result >> 1) | 0x02; Assume that ad_result has the same initial value as calculated in (c). Show work for partial credit. ad_result 3 Name:_______________________________________________ Problem #2 a) Write a function called Port_Init which correctly configures the ports for input and output. Do not change the state of P2.4 and P2.7. You must use hexadecimal values. void Port_Init(void) { Code Comments //Set P2.0, P2.3, P2.5, P2.6 to push‐pull mode //Set P2.1, P2.2 to open‐drain mode //Set P2.1, P2.2 to high impendence state } 4 Name:_______________________________________________ b) Write a function called ControlLED, which returns 1 when both push buttons are not pressed, 2 when push button 1 is pressed, 3 when push button 2 is pressed, and 4 when both push buttons are pressed. A table of each case is shown below. The buttons are wired the same as those in Lab1, and also Figure 5.9 of the LITEC manual. Push Button 1 OFF ON OFF ON Push Button 2 OFF OFF ON ON ControlLED 1 2 3 4 sbit at ____________________ PB1; /* Push button 1 on P2.1 */ sbit at ____________________ PB2; /* Push button 1 on P2.2 */ _____________________ ControlLED(void) { unsigned char returnValue = 0; /* value to be returned by the function */ return ______________________________; } 5 Name:_______________________________________________ c) Write a function called Decision which uses the ControlLED function in question (b). The Decision function should turn two bi‐color LEDs on and off as shown in the table below. Having a higher potential on sbit “a” (i.e. BILED1a) turns the LED red. Having a higher potential on sbit “b” (i.e. BILED1b) turns the LED green. ControlLED 0 1 2 3 BILED1 Red Off Green Green BILED2 Red Green Off Green sbit at ____________________ BILED1a; /* BILED1 on P2.0 */ sbit at ____________________ BILED1b; /* BILED1 on P2.3 */ sbit at ____________________ BILED2a; /* BILED2 on P2.5 */ sbit at ____________________ BILED2b; /* BILED2 on P2.6 */ void Decision(void) { } 6 Name:_______________________________________________ Problem #3 a) Write a Port_Init function to properly initialize P1.1 to be analog input and P2.3 to be digital output. Do not change any other pins’ configuration. void Port_Init(void) { } b) Write a ADC_Init function which sets VREF to use internal voltage of 2.4V, the gain to be 2, and enable ADC1. void ADC_Init(void) { } 7 Name:_______________________________________________ c) Write a Timer_Init function which uses Timer 0 as a 13‐bit counter using System Clock. You must also enable the Timer 0 overflow interrupt. You must start the counting in this function. void Timer_Init(void) { } d) Assuming Timer 0 is set up as in part (c), determine the number of overflows that occur in 0.5 seconds. Number overflows 8 Name:_______________________________________________ e) Write a function called Buzzer_Control which turns on a buzzer for the time calculated below, and then turns it off before returning. The function should read the value of an A/D conversion on P1.1, and calculate a delay . The minimum delay should 700ms if the value read is 0, and the maximum delay should be 7000ms if the value read is 255. Assume that a function called read_AD_input exists which returns an unsigned char with the value obtained from A/D conversions on P1.1. Assume that BUZZ is an sbit for the buzzer pin, that the ports have been configured properly, and that the buzzer is wired the same as it was in Lab 1. Use Timer 0 and assume that the Timer_Init() function you wrote in part c above has been called. Show any calculations for partial credit. void Buzzer_Control { } 9 Name:_______________________________________________ 10 ...
View Full Document

This note was uploaded on 10/22/2011 for the course ENGR 2410 taught by Professor Wallack during the Fall '09 term at Rensselaer Polytechnic Institute.

Ask a homework question - tutors are online