EE319K_FINAL_SOL_2010 - EE319K Spring 2010 Final Exam...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE319K Spring 2010 Final Exam Solution B Page 1 Jonathan Valvano May 17, 2010 (5) Question 1. 10k in parallel with 10k is 5k, using the rule R1 || R2 = (R1*R2)/(R1+R2). The total resistance is 15k. Using the voltage divider equation V = 3.3V(5k/15k) = 1.1V. Another solution first uses Ohm’s Law to calculate current I = 3.3V/15k, then uses Ohm’s Law again, V = 5k*I = 3.3V(5k/15k) = 1.1V. (5) Question 2. (3) Part a) TCNT is running at 125ns times 4, which is 500ns. The output compare 7 interrupt occurs every 100 TCNT cycles, which is 50 μ sec. (2) Part b) The sampling rate is determined by the interrupt frequency, 1/50 μ s is 20 kHz. According to the Nyquist Theorem, the largest frequency component faithfully represented in the data in the buffer will be 10 kHz (one half the sampling rate.) (10) Question 3. The trick is you have to wait for both the rising and falling edges. void main(void){ unsigned char count=0; DDRT |= 0x01; // PT0 is output DDRT &= ~0x02; // PT1 is input while(1){ while((PTT&0x02)==0){}; // wait until rising edge // PT1 is now high count++; if((count&0x01)==0){ // count is even PTT |= 0x01; // pulse PTT &= ~0x01; } while(PTT&0x02){}; // wait until falling edge // PT1 is now low } (20) Question 4. We need a shared global pointer. Clear TDRE by read status, write data unsigned char *Pt; void SCI1_Output(unsigned char *Buffer){ if(Buffer[0] == 0) return; // ignore empty buffers
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

EE319K_FINAL_SOL_2010 - EE319K Spring 2010 Final Exam...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online