



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




College of Engineering Electrical Engineering and Computer Sciences Department
145M Microcomputer Interfacing Lab
Final Exam Solutions May 17, 1996
Problem 1a
4095 = 5 volts
0 = 0 volts
[7 points off if output is shown to rise to 6.1 volts at a D/A input of 5000] [5 points off if the output is 5 volts or 0 volts when the number is between 4095 and 5000]
Problem 1b The desired triangle wave is most easily produced by sending the sequence 0, 1, 2,.. ., 4094, 4095, 4094,.. ., 2, 1, 0, 1, 2,.. ., 4094, 4095, 4094,.. ., 2, 1, 0, etc. to the D/A.
PROBLEM 2
2a
Analog input
A/D
Convert
Conversion complete
Data (^) Parallel input port BI STROBE
Mode BI CTS
Micro- computer
2b
BI CTS = start conversion is normally low BI STROBE = conversion complete is normally high 1 Program makes BI CTS high 2 BI CT high puts S/H into hold mode 3 BI CTS low-high edge begins A/D conversion. 4 When A/D ends conversion, it makes BI STROBE low 5 When program detects BI STROBE low, it reads the input port registers 6 Program makes BI CTS low, and A/D sets BI STROBE high
[2 points off for omitting the S/H] [2 points off for omitting step 6]
Problem 2c
Analog input
S/H output
Bi CTS = S/H mode = start conversion
Conversion complete = BI STROBE (read data)
Data (^) Old New
[3 points off if no analog input and S/H output] [2 points off if no A/D output data]
Problem 3a
Preamplifier Vref Comparator
Parallel input port
Counter/ timer Micro- computer
Touch plate circuit
Microphone
[5 points off for adding analog inputs and reading comparator on one bit- poor design to put different signals on the same bit when there are 15 other bits available.] [5 points off for connecting preamp output (unknown analog voltage) to parallel input port (needs 5 volts, which the comparator was intended to produce)]
Problem 3b Loop until start comparator goes high Zero counter/timer loop until touch plate circuit goes high Read counter/timer take difference, divide by 1 million, write to screen
Problem 4a
Problem 4c
For data acquisition, the timing diagram is:
Analog input
Counter A out = start conversion = flip-flop clock
Counter B = flip-flop input not reliable not reliable
valid
Flip-flop output = memory address
old value new value
Conversion complete = memory write
A/D output = memory data in not reliable^ not reliable
valid
For program readback of memory circuit:
Counter A out = flip-flop clock
Counter B = flip-flop input not reliable not reliable
valid
Flip-flop output = memory address
old value new value
Program output when A = 0 = memory read
Read input port
Problem 5a
log(magnitude)
Fourier frequency index
[5 points off for not displaying discrete harmonics]
Problem 5b Let a(t) be the desired 10 Hz square wave and b(t) be the output of the amplifier with a square wave input. First let us compute the impulse response of the amplifier, then use the impulse response to determine the desired input (as in laboratory exercise 24).
Step 1: determine the impulse response These are related to c(t), the unknown impulse response of the amplifier by: b(t) = a(t) convolved with b(t) This means that the corresponding Fourier transforms have Bn = An Cn, a simple multiplication. The impulse response can then be computed as the inverse FFT of Bn /An.
Step 2: determine the input that produces a square wave We know that a(t) = d(t) convolved with c(t), where a(t) is the desired square wave output, c(t) is the impulse response we determined in step 1, and d(t) is the unknown input waveform that produces the square wave a(t). d(t) = inverse FFT of An/Cn = inverse FFT of An (An/Bn).
In the case where we want to produce a 10 H square wave, we know exactly the Fourier coefficients that are needed in the above equation (i.e. those corresponding to 10 Hz, 30 Hz, etc.)
Problem 5c
We only have the response of the amplifier to a 10 Hz square wave input, which provides information on its response only at 10 Hz, 30 Hz, 50 Hz, etc. However, to generate a 20 Hz output square wave, we need to know Bn at 20 Hz, 60 Hz, 100 Hz, etc. One solution is to interpolate the real and imaginary Fourier components between the known frequency values.
Problem 5d