Docsity

Microcomputer Interfacing Lab - Spring 2011 - Final Exam | EL ENG C145M, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
page 1 S. Derenzo
NAME (please print)
STUDENT (SID) NUMBER
UNIVERSITY OF CALIFORNIA, BERKELEY
College of Engineering
Electrical Engineering and Computer Sciences
EECS 145M: Microcomputer Interfacing Lab
LAB REPORTS:
1 _________________
2 __________________
3 ___________________
8 _________________
9 __________________
10 ___________________
21 _________________
22 __________________
23 ___________________
24a _________________
24b _________________
Total of top 4 Long Lab Grades
Total of top 4 Short Lab Grades
Lab Participation
Mid-Term #1
Mid-Term #2
Final Exam
Total Course Grade
_______________ (400 max)
_______________ (100 max)
_______________ (100 max)
_______________ (100 max)
_______________ (100 max)
_______________ (200 max)
_______________ (1000 max)
COURSE LETTER
GRADE
Spring 2011 FINAL EXAM (May 10)
Answer the questions on the following pages completely, but as concisely as possible. The exam
is to be taken closed book. Use the reverse side of the exam sheets if you need more space.
Calculators are OK.
Partial credit can only be given if you show your work.
FINAL EXAM GRADE :
1 __________ (30 max) 2 __________ (30 max) 3 __________ (45 max)
4 __________ (40 max) 5 __________ (55 max)
TOTAL __________ (200 max)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Microcomputer Interfacing Lab - Spring 2011 - Final Exam | EL ENG C145M and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

page 1 S. Derenzo

NAME (please print)

STUDENT (SID) NUMBER

UNIVERSITY OF CALIFORNIA, BERKELEY

College of Engineering

Electrical Engineering and Computer Sciences

EECS 145M: Microcomputer Interfacing Lab

LAB REPORTS:

1 _________________ 2 __________________ 3 ___________________

8 _________________ 9 __________________ 10 ___________________

21 _________________ 22 __________________ 23 ___________________

24a _________________ 24b _________________

Total of top 4 Long Lab Grades

Total of top 4 Short Lab Grades

Lab Participation

Mid-Term #

Mid-Term #

Final Exam

Total Course Grade

_______________ (400 max)

_______________ (100 max)

_______________ (100 max)

_______________ (100 max)

_______________ (100 max)

_______________ (200 max)

_______________ (1000 max)

COURSE LETTER

GRADE

Spring 2011 FINAL EXAM (May 10)

Answer the questions on the following pages completely, but as concisely as possible. The exam

is to be taken closed book. Use the reverse side of the exam sheets if you need more space.

Calculators are OK.

Partial credit can only be given if you show your work.

FINAL EXAM GRADE :

1 __________ (30 max) 2 __________ (30 max) 3 __________ (45 max)

4 __________ (40 max) 5 __________ (55 max)

TOTAL __________ (200 max)

Initials

Spring 2011 EECS 145M Final Exam page 2 S. Derenzo

PROBLEM 1 (total 30 points)

In this course we discussed the following analog and digital interfacing circuits:

Tri-state driver D-type flip-flop

Transparent latch Comparator

Sample-and-Hold amplifier Difference amplifier

Exclusive OR Digital delay

1 .1 (10 points) How would you use one or more of these for removing digital glitches at the

output of a 16-bit digital counter or clock where no handshaking lines are provided?

1.2 (10 points) How would you use one or more of these to sample an analog signal at a precise

instant in time defined by a low-to-high logic level?

1.3 (10 points) How would you use one or more of these to sample an 8-bit digital signal at a

precise instant in time defined by a low-to-high logic level?

Initials

Spring 2011 EECS 145M Final Exam page 4 S. Derenzo

PROBLEM 3 (45 points) Design a computer-controlled system for testing eight 12 - bit A/D

converters.

You are provided with the following:

  • eight A/D converters (to be tested together)
  • eight 16-bit tri-state drivers
  • a microcomputer with the following:
    • a 16-bit D/A converter with 1/2 LSB absolute accuracy and 10 μs settling time
    • two 16-bit parallel input ports
    • two 16-bit parallel output ports

You may assume the following:

  • The 16-bit parallel output ports are in “transparent” mode (no handshaking). New data can

be written to the port every 2 μs.

  • You have a timer function wait( N ), that can delay program execution for N μs.
  • The A/D converter requires a “start conversion” low-to-high edge signal and after

conversion provides an “output data available” low-to-high edge. The A/D converter sets

“output data available” low and resets all internal functions when “start conversion” goes

low.

  • You must wait until the A/D has signaled that its data are ready before reading its output.

Hint: Think about Laboratory Exercise 9 (A/D converters) and how you would automate the

measurement and data analysis procedures.

3.1 (15 points) Draw a block diagram of the major components, including two of the eight A/D

converters being tested. Show and label all essential data and control lines.

Initials

Spring 2011 EECS 145M Final Exam page 5 S. Derenzo

3.2 (10 points) List the steps your program must do to measure the first transition voltage

V(0,1) of the first A/D converter (pseudocode is OK, so long as the logic is clear).

3.3 (10 points) How would you determine the maximum linearity error of the eight A/D

converters?

3.4 (10 points) With what accuracy could this system measure the quantities in parts 3.2 and

3.3 in units of 1 LSB of the A/D?

Initials

Spring 2011 EECS 145M Final Exam page 7 S. Derenzo

4.3 (10 points) Use one of the above theorems to explain how frequency aliasing occurs in the

Fourier transform of a sampled waveform and how its effects can be controlled.

4.4 (10 points) Use one of the above theorems to explain how spectral leakage occurs in the

Fourier transform of a sampled waveform and how its effects can be controlled.

Initials

Spring 2011 EECS 145M Final Exam page 8 S. Derenzo

PROBLEM 5 (total 55 points):

You wish to measure very small signals in the frequency range from 0 to 8,000 Hz to an

accuracy of 1%. You design and build a sensor and amplifier system to do this but see

background noise at the output on your oscilloscope. The noise has both a random component

(white noise from your amplifier) and periodic components (electromagnetic interference from

unknown external circuits). In this problem you will sample and analyze the noise.

5.1 (12 points) Design a system for sampling the noise waveform at 32,768 Hz and determining

its frequency content from 0 to 8,000 Hz so that two components 1 Hz apart can be individually

resolved. Sketch your design in block form, including the system to be tested, interfacing

circuits, and computer. Label all components and signals.

5.2 (12 points) Describe in detail your process of sampling the signal and performing the FFT.

Note: the FFT was designed for a number of samples that is a power of two.

Initials

Spring 2011 EECS 145M Final Exam page 10 S. Derenzo

5.5 (12 points) Knowing the precise period from part 5.4, how could you reconstruct its time

waveform separate from all the other noise backgrounds with the highest signal to noise ratio?

145M Final Exam Solutions page 1 May 10, 20101 S. Derenzo

UNIVERSITY OF CALIFORNIA

College of Engineering

Electrical Engineering and Computer Sciences Department

145M Microcomputer Interfacing Lab

Final Exam Solutions May 10, 2011

1.1 When the output of a 16-bit digital counter or clock changes value, not all the bits will

change at exactly the same time. From the time when the first bit changes until the time the

last bit changes the data will be erroneous (i.e. a glitch). One way to prevent the receiver

from reading the erroneous data is to provide a “data valid” handshaking line. If this is not

available, the “data valid” signal can be generated in the same way as was described for

deglitching the analog output of D/A converters.

Since a handshaking line was not provided in the problem, for full credit the answer needed

to have (1) 16 digital output lines and (2) a circuit that generates a “data invalid” pulse that

was asserted when any bit could be changing.

A final transparent latch or D-type flip-flop was not necessary but was accepted (their

outputs will have the same glitches if read without a handshaking line)

[5 points off for connecting a S/H amplifier to the output; the S/H has one analog input and

one analog output]

[5 points off for a single input line with delay and one exclusive OR but other bits and no

inclusive OR to generate the “data valid” line]

[

1.2 Use a S/H amplifier that goes into hold mode on the digital edge

[5 points off for using digital components or interconnecting analog and digital signals]

1.3 Use eight D-type flip-flops that latch the 8 bits of data on the clock edge. Eight transparent

latches could also work if they went from transparent to hold on the control edge.

[5 points off for using eight tri-state drivers, which have no latching capability]

145M Final Exam Solutions page 3 May 10, 20101 S. Derenzo

The following are essential:

  • Connect 16 bits from the digital output to the D/A converter
  • Connect the analog output of the D/A to the analog inputs of all A/Ds

Note: S/H amplifiers are not needed since the D/A can provide the hold

  • Connect the 12 bit A/Ds to separate tri-state drivers
  • Connect the outputs of the tri-state drivers together to form a data bus (can’t input 8 x

12 bits in parallel)

  • Connect the data bus to 12 bits of the parallel input port
  • Provide 8 separate output port lines for initiating conversion of the 8 A/Ds (could be

combined with next signal)

  • Provide 8 separate output port lines for enabling the 8 separate tri-state drivers (this was

essential)

  • Provide input for 8 separate input port lines to indicate when individual A/Ds have

completed conversion

[7 points off for omitting the D/A converter]

[5 points off for not connecting the tri-states to form a 12-bit bus and using 8 digital input

ports]

[3 points off for using the A/D data available lines to control the tri-states; the computer will

never know when to read the bus]

3.2 The steps needed to measure the first transition voltage V(0,1) for the first A/D converter.

1 set SC1 low, disable all tri-state drivers, set N = 0 (16 bits)

2 Put N on D/A

3 wait 10μs until D/A has settled [using wait(10)]

145M Final Exam Solutions page 4 May 10, 20101 S. Derenzo

4 Put low-high edge on SC1 output line to start conversion

5 Wait until output data available

6 enable tri-state 1 (disable all others)

7 read input port to get value M

8 Put high-low edge on SC1 output port to end conversion cycle

9 if M=0, increase N by one and loop back to step 2

10 If M=1, save (D/A voltage step)(N-1/2) as the transition voltage

[1 point off for not starting the D/A input at zero]

[2 points off for not testing the A/D output for the 0 to 1 transition]

[3 points off for not incrementing the D/A input until a A/D transition occurs]

[2 points off for not waiting for D/A to settle]

[2 points off for not waiting for A/D output data available signal; you do not know the

conversion time]

[2 points off for not enabling tri-state #1 while putting all others in high-impedance mode]

3.3 Send successive 16-bit numbers 0 to 2

  • 1 to the D/A converter and convert the analog

output with the A/D. Whenever the A/D output value changes, store the corresponding D/A

value in a transition voltage table

Determine the D/A values corresponding to first and last A/D transition voltages, and the

equation of the line that passes through them. Linearity is a measure of how closely the

other measured transition values pass through the line.

[3 points off for determining maximum differential linearity or maximum absolute accuracy]

[3 points off for using the maximum deviation between the measured and ideal A/D output,

which can never be better than ½ LSB. The linearity error for the A/D is the difference

between the measured and ideal transition voltages, which can be much better than ½ LSB]

[3 points off for using the average value of the inputs that make the output = 0 rather than

determining the transition voltage directly]

3.4 The method can determine the A/D accuracies to 1/16 A/D LSB (±1/32 LSB was OK).

Note that 1 A/D LSB = 16 D/A LSBs.

[7 points off for an answer <1/128 A/D LSB]

[7 points off for an answer > 2 A/D LSB]

[5 points off for an answer of 1/2 or 1 A/D LSB]

4 .1 Fourier Convolution Theorem: The Fourier transform of the convolution of two functions is

equal to the product of their Fourier transforms (Textbook p 391, lecture slide #237).

[3 points off for stating the Fourier Frequency Convolution Theorem]

4.2 Fourier Frequency Convolution Theorem: The Fourier transform of the product of two

functions is equal to the convolution of their Fourier transforms (Textbook p 394, lecture

slide #244)

[7 points off for writing the same thing in 4.1 and 4.2]

145M Final Exam Solutions page 6 May 10, 20101 S. Derenzo

Essential components for a complete solution were

  • Sensor
  • Amplifier
  • Low-pass filter with design
  • A/D converter (S/H not required for full credit) or analog input port
  • Digital input port (if no analog input port)
  • Digital output port
  • Start conversion line between digital output port and A/D converter (~5 kHz)
  • Analog lines connecting sensor, amplifier, filter, A/D converter or analog input port
  • Digital lines between A/D converter and digital input port

[5 points off if no LPF or design; you were supposed to know that an anti-aliasing filter is

always required when sampling a signal that is not band limited]

[3 points off if LPF but no design]

[2 points off for f C

around 8 kHz and nothing more]

Since 1% accuracy was desired from 0 to 8,000 Hz, a low-pass filter with a gain of 0.99 at

8,000 Hz was required. To reduce the white noise and higher periodic harmonics, a gain of

0.01 at frequencies that could alias to 8,000 Hz was also required.

f1 = 8,000 Hz where G1 = 0.

f2 = fs - f1 = 24, 768 Hz where G2 = 0.

The lowest order filter that drops from a gain of 0.99 to 0.01 over a factor of 3.096 in

frequency is n = 6.

At G1 f/fc = 0.723; at G2 f/fc = 2.154; the frequency ratio is 2.

8,000 Hz/0.723 < fc < 24,768/2.

Answer is n = 6; 11,065 Hz < fc < 11,499 Hz

n = 8 and n = 10 were also accepted for full credit

5.2 For peaks separated by 1 Hz to be individually resolved, need at least S = 3 s. Here we

choose S = 4 s which keeps the number of samples a power of 2. The Fourier frequencies

are separated by 1/S = 0.25 Hz. (S = 2 s was accepted)

  1. Start 32,768 Hz clock, c = clock_count, k = 0

145M Final Exam Solutions page 7 May 10, 20101 S. Derenzo

  1. wait until clock_count > c

  2. send convert signal

  3. wait until data available received

  4. read noise data and store in array(k)

  5. c = c + 1; k = k + 1

  6. loop back to 2) until c = S x 32,

  7. multiply data by raised cosine window

  8. perform FFT

[4 points off if no raised cosine window; you were supposed to know that such a window is

always required before the FFT if you can not guarantee that all harmonics in the signal will

be sampled for a whole number of cycles]

[2 points off for sampling for 1 second; this would not make two components 1 Hz apart to

be individually resolved]

[4 points off for sampling for 0.5 seconds]

5.3 The random white noise will have a uniform spread of Fourier amplitudes over all the

frequencies below 8,000 Hz that are passed by the LPF. Period noise would appear as one

peak or evenly spaced peaks that correspond to the harmonics.

[2 points of for not describing the random noise as being spread over all frequencies passed

by the LPF]

[3 points off for describing random or periodic, but not both]

5.4 Sampling for 4 sec will make the first harmonics of the periodic 440 Hz to 441 Hz appear

somewhere around Fourier frequency index n = fS = (440.5 Hz) (4s) = 1,762. The 18th

harmonic will be the harmonic near 7,900 Hz, near frequency index 31,700. The frequency

index of the18th harmonic peak can be determined to 1 part in 31,700 and the frequency of

the first harmonic can be determined to an accuracy of one part in 32k or 440Hz/32k =

0.013 Hz. Since we need the accuracy to be 0.001 Hz, we need to sample 16 times longer or

64 s.

Sampling for 64 s places the 18th harmonic near frequency index n = 18fS = 18 (440.5 Hz)

(64 s) = 507,000. The frequency index of the18th harmonic peak can be determined to 1 part

in 507,000 and the frequency of the first harmonic can be determined to an accuracy of one

part in 507k or 440Hz/507k = 0.0009 Hz

[8 points off for S = 1 s, which cannot provide 0.001 Hz accuracy]

[4 points off for S = 1000 s or more, which makes ∆f < 0.001 Hz in the FFT but certainly

not in the shortest possible time]

[5 points off for a careful analysis of the ratio of amplitudes because the amplitudes also

include other random and periodic noise and will prevent a frequency determination good to

0.001 Hz in 440 Hz.]

[5 points off for sweeping through many values of S to find one where the first harmonic is

centered exactly on one FFT frequency. This is slow.]

[6 points off for sweeping a notch filter through frequencies; Fourier techniques were

required]

[3 points off for searching through the FFT to find a “clean” harmonic peak centered exactly

on one FFT frequency. This depends too much on luck.]

145M Final Exam Solutions page 9 May 10, 20101 S. Derenzo

145M Numerical Grades:

Short

labs

Long

labs

Lab Partic. Midterm #1 Midterm #2 Final Total

Average 90.6 365.8 96.0 77.2 66.2 156.6 858.

rms 6.7 16.9 0 13.52 19.4 30.1 63.

Maximum 100 400 7.6 100 100 200 1000

145M Letter Grade Distribution

Letter Grade Course Totals (1000 max)

A+ 962

A 920, 922, 931, 933.

A– 906, 910

B+ 883, 883.5, 890, 893, 894

B 863, 869, 870.

B- 822, 833, 838

C+ 791, 793.5, 809, 813

C

C– 738.5, 743.5, 745.

D+

D

D–