Docsity

UC Microcomputer Interfacing Lab Final Exam Solutions, May 19, 1995 (145M), Exams of Microcomputers

Toggle sidebar
bg1
UNIVERSITY OF CALIFORNIA
College of Engineering
Electrical Engineering and Computer Sciences Department
145M Microcomputer Interfacing Lab
Final Exam Solutions May 17, 1996
Problem 1a
•The 12-bit D/A converter can only see the lowest 12 bits of the binary number.
•When the rising sequence reaches 4095 (0000 1111 1111 1111), the D/A outputs 5 volts.
•The next number is 4096 (0001 0000 0000 0000 ), so the D/A sees input = 0 and the output
drops to 0 volts.
•The next number is 4097 (0001 0000 0000 0001), so the D/A sees input = 1, and the output
begins to rise. This continues as shown in the figure below:
4095 = 5 volts
0 = 0 volts
5000-4095 = 905
[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
S/H
Analog
input
A/D
Convert
Conversion complete
Data Parallel
input
port
BI STROBE
BI CTS
Mode
Micro-
computer
2b BI CTS = start conversion is normally low
BI STROBE = conversion complete is normally high
1Program makes BI CTS high
2BI CT high puts S/H into hold mode
3BI CTS low-high edge begins A/D conversion.
4When A/D ends conversion, it makes BI STROBE low
5When program detects BI STROBE low, it reads the input port registers
6Program 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]
145M Final Exam Solutions page 1 May 19, 1995 S. Derenzo/J. Henue
pf3
pf4
pf5

Partial preview of the text

Download UC Microcomputer Interfacing Lab Final Exam Solutions, May 19, 1995 (145M) 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 17, 1996

Problem 1a

  • The 12-bit D/A converter can only see the lowest 12 bits of the binary number.
  • When the rising sequence reaches 4095 (0000 1111 1111 1111), the D/A outputs 5 volts.
  • The next number is 4096 (0001 0000 0000 0000 ), so the D/A sees input = 0 and the output drops to 0 volts.
  • The next number is 4097 (0001 0000 0000 0001), so the D/A sees input = 1, and the output begins to rise. This continues as shown in the figure below:

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

S/H

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

  • Since exactly 10 cycles are sampled, the first harmonic at 10 Hz appears at Fourier coefficient H 10 and at H65,536-10.
  • Since the square wave was symmetric, only odd harmonics will appear. The mth harmonic will have frequency 10m Hz and appear at Fourier coefficient H10m, and at H65,536-10m.
  • The magnitudes of the harmonics will fall as 1/m (–6 dB per octave goes as 1/f).

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

  • Method is unreliable at 5 Hz because amplifier response is not measured at 5 Hz when using 10 Hz square wave input. Needed response at 15 Hz, 25 Hz, etc. would have to be interpolated.
  • Method is not reliable at 10 kHz because amplifier response is down by a factor of 1000 from its low frequency response. A/D resolution and noise limit accuracy.