UC Berkeley EECS Dept. 1995 Microcomputer Interfacing Lab Final Exam Solutions, Exams of Microcomputers

The solutions to the final exam of the microcomputer interfacing lab held at the university of california, berkeley, electrical engineering and computer sciences department in may 1995. The exam covers topics such as tri-state buses, data handshaking, d/a conversion, and fourier transforms.

Typology: Exams

2012/2013

Uploaded on 03/22/2013

sarup
sarup 🇮🇳

30 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UNIVERSITY OF CALIFORNIA
College of Engineering
Electrical Engineering and Computer Sciences Department
145M Microcomputer Interfacing Lab
Final Exam Solutions May 19, 1995
Problem 1a
Device 1
Device 8
Input
port
"ready for data" (1-8)
Output
port
tri-state 1
tri-state 8
8
select 1
select 8
"data available 1" • • •
• • • • •
"data available 8"
Micro-
computer
[3 points off if no tri-state between output bus and each device or no select line to each device]
[2 points off for each if “data available” or “data taken” lines missing]
Problem 1b
Use 8 input lines for “ready for data” from each device.
Use 8 output lines for “data available” to each device and to select the corresponding the octal tri-state.
Use 8 output lines for the output data bus
The “full handshaking” steps are:
1The computer sets all 8 “data available”/select lines FALSE
2The computer checks that device n (the one we want to write to) has “ready for data” TRUE
3The computer writes the 8 data bits to the inputs of all octal tri-states
4The computer asserts “data available”/select output line n TRUE (or the computer asserts “data
available” and the device selects an octal tri-state driver.)
5The device detects “data available” and sets “ready for data” FALSE
6The device reads the data and sets “ready for data” TRUE
7The computer detects the “ready for data” FALSE-TRUE edge and sets “data available”/select
FALSE
The minimum accepted for full credit:
1Device n tells computer “ready”
2Computer selects tri-state n (or device n)
3Computer asserts data on data bus
4Computer tells device n “data available”
5Device n reads data
Problem 2
1Set all D/A bits to 0
2 Set i = N (the MSB)
3Set bit i to 1
4If D/A output > A/D input, set bit i to 0
5i = i – 1
6If i > 0, go back to step 3
145M Final Exam Solutions page 1 May 19, 1995 S. Derenzo/J. Henue
pf3
pf4
pf5
pf8

Partial preview of the text

Download UC Berkeley EECS Dept. 1995 Microcomputer Interfacing Lab Final Exam Solutions and more Exams Microcomputers in PDF only on Docsity!

UNIVERSITY OF CALIFORNIA

College of Engineering Electrical Engineering and Computer Sciences Department

145M Microcomputer Interfacing Lab

Final Exam Solutions May 19, 1995

Problem 1a

Device 1

Device 8

Input port

"ready for data" (1-8)

Output port

tri-state 1

tri-state 8

select 1^8

select 8

"data available 1" • • •

  • • • • •

"data available 8"

Micro- computer

[3 points off if no tri-state between output bus and each device or no select line to each device] [2 points off for each if “data available” or “data taken” lines missing]

Problem 1b Use 8 input lines for “ready for data” from each device. Use 8 output lines for “data available” to each device and to select the corresponding the octal tri-state. Use 8 output lines for the output data bus

The “full handshaking” steps are:

1 The computer sets all 8 “data available”/select lines FALSE

2 The computer checks that device n (the one we want to write to) has “ready for data” TRUE

3 The computer writes the 8 data bits to the inputs of all octal tri-states

4 The computer asserts “data available”/select output line n TRUE (or the computer asserts “data available” and the device selects an octal tri-state driver.)

5 The device detects “data available” and sets “ready for data” FALSE

6 The device reads the data and sets “ready for data” TRUE

7 The computer detects the “ready for data” FALSE-TRUE edge and sets “data available”/select FALSE

The minimum accepted for full credit:

1 Device n tells computer “ready”

2 Computer selects tri-state n (or device n)

3 Computer asserts data on data bus

4 Computer tells device n “data available”

5 Device n reads data

Problem 2

1 Set all D/A bits to 0

2 Set i = N (the MSB)

3 Set bit i to 1

4 If D/A output > A/D input, set bit i to 0

5 i = i – 1

6 If i > 0, go back to step 3

Problem 3

  • Use a microcomputer with analog input and a clock to trigger periodic sampling
  • Use an anti-aliasing filter to eliminate white noise above 1/2 the sampling frequency
  • Sample M values over a time window S.
  • Use a Hanning window to reduce the spectral leakage of the white noise background into the regions of the spikes.
  • Perform the FFT.
  • Due to the random, non-periodic noise, it is not possible to see the periodic signal in the time domain- but the FFT concentrates the periodic signal at discrete frequencies- the harmonics.
  • The first harmonic should always be non-zero. If it appears at Fourier index n 1 , then the period P = S/n 1 , where S is the sampling window width. Depending on the harmonic content of the periodic signal, there may be other non-zero harmonics. The kth harmonic will appear at nk = k n 1.
  • If no spikes are visible, then S is shorter than the period P, and it will be necessary to increase S and try again. [10 points off for trying to solve the problem entirely in the time domain] [3 points off for sampling, taking the FFT, subtracting the average noise, zeroing the values between the harmonic spikes, and then taking the inverse FFT to measure the period in the time domain. This approach requires pattern recognition and is not as accurate or as easy as finding the index of the first harmonic in the FFT.]

Problem 4a The idea was to use negative feedback to track a rising pulse on CH. When the pulse reaches its peak and starts dropping, the diode effectively disconnects CH, and the comparator produces an edge that starts the A/D conversion of the peak value held on CH. When conversion is complete, the capacitor is reset.

Input

To analog input port (A/D)

Data available (start A/D conversion)

Comparator in PKD-

Vc

Ready for data (reset) CH

Vin

Vout

[1 point off for not showing resistors] [3 points off for unlabeled lines, extra lines] [4 points off for missing lines]

Problem 4b

1 Pulse arrives

2 CH charges

3 When pulse passes peak value, Vout becomes greater than Vin, triggering the comparator to produce a “data available” pulse.

4 The leading edge of this pulse starts A/D conversion

5 After conversion, computer sends a pulse on the “ready for data” line to the PKD-01 reset, which discharges CH.

[5 points off for using a large threshold voltage and a delay]

Problem 4c PKD-01 settling time 45 μs Comparator trigger time 150 ns Switching time 100 ns

The third transform had M = 64, m = 16. So H 0 = 16 and Hn = 0 for n = 4k. The purpose was to show that for the same M = 64, increasing the rectangle width from 8 to 16 decreased the width of the transform by a factor of 2.

8

FFT

[3 points off for no sinc function]

[3 points off if the second transform did not have more resolution than the first transform]

[3 points off if the third transform did not have narrower lobes than the second transform]

Problem 5b

average (d.c.) is zero, exactly 2 cycles per 128 samples.

1

As above, but average shifted from 0 to 1

2

[2 points off per missing line, 1 point off for location, 1 point off for magnitude]

Problem 5c

Same as second graph above, but with spectral leakage

2

[2 points off if d.c. not consistent with second graph above]

Problem 5d

Since 5 square waves were sampled, we expect non-zero magnitudes at n = 5 and 123 (first harmonic at 15 Hz), n = 15 and 113 and (third harmonic at 45 Hz), n =25 and 103 (fifth harmonic at 75 Hz), etc. The additional non-zero magnitudes at n = 20 and 108 corresponds to a pure 60 Hz harmonic, which must be due to power line interference in the lab. [3 points off if odd harmonics not identified] [4 points off if 60 Hz electromagnetic interference not identified]

Problem 6a

  • Use an anti-aliasing filter to block white noise from the 1 MHz amplifier that would otherwise obscure the weak signal.
  • Use a Hanning window to reduce spectral leakage in the return echo, which could be at any frequency

50 kHz oscillator

Sound emitter

Microphone

Amplifier (1 MHz)

Anti- aliasing filter

Analog input port

Micro- computer

[3 points off for using a 2 MHz low pass filter- much higher than needed] [2 points off each for missing microphone or sound emitter]

Problem 7a

  • The Fourier transform of the sum of two functions is the sum of their Fourier transforms
  • The Fourier transform of the product of two function is the convolution of their Fourier transforms

c(t) = F e

−t/ τ

[ ] +^ F^ 2e

−t/ τ

[ cos(2πfot)]

1 + 4 π^2 τ^2 f^2

1 + 4 π^2 τ^2 f^2

δ(f − f 0 ) +δ(f + f 0 )

^

1 + 4 π^2 τ^2 f^2

1 + 4 π^2 τ^2 (f − f 0 )^2

1 + 4 π^2 τ^2 (f + f 0 )^2

Problem 7b

  • The Fourier transform consists of three peaks, at –100 Hz, 0 Hz, and + 100 Hz.
  • Each peak has the same profile as a one-pole low-pass filter, with a corner frequency that is fc = 1/(2πτ) = 0.159 Hz away from the center of the peak. So the peaks are narrow compared to their separation.
  • In between the peaks (say at 50 Hz), the Fourier magnitude is 0.0032 + 0.0032 + 0.0011 = 0.

f (Hz)

Fourier transform magnitude 0

Problem 7c

  • The Fourier convolution theorem says that if a(t) is the convolution of b(t) and c(t), then F (a) is equal to the product F (b) x F (c).
  • So the input b(t) that when convolved with the impulse response c(t) gives a square wave a(t) is computed as:

b(t) = F

[ F (a)/ F (c)]

  • F (c) was computed in part 7a above and F (a) is well known.
  • The above example is simple enough to be done analytically, using integral Fourier transforms, but it could also be done using the FFT.

145M Final Exam:

Problem 1 2 3 4 5 6 7 Total Average 26.1 12.3 12.1 25.7 21.7 24.7 23.1 145. rms 3.9 3.9 3.3 9.3 9.2 4.6 4.6 32. Maximum 30 15 15 40 40 30 30 200

145M Numerical Grades:

Lab total Lab Partic. Midterm #1 Midterm #2 Final Total Average 458.6 91.5 84.5 86.3 145.7 866. rms 30.9 8.5 7.1 10.6 32.1 102. Maximum 500 100 100 100 200 1000

The average scores of the two lab report graders differed by only 0.03 points. No equity correction was necessary.

145M Letter Grade Distribution (passing students only)

Letter Grade Course Totals (1000 max) A+ 952 A 920, 944, 946, 948.5, 950.5* A– 897.5, 899 B+ 870, 872.5, 873, 877 B 838, 849, 855, 855, 858 B– none C+ 794, 804, 814 C none C– none D+ none D none D– 667

  • graduate students