Lab: Measuring Moon Distance & Producing Analog Voltages, Exams of Microcomputers

Information on two microcomputer interfacing laboratory projects from the university of california, berkeley's eecs 145m course. The first project involves measuring the distance to the moon using a pulsed laser, retro-directive mirror, photodetector, computer, and counter/timer circuit. The second project entails designing a system for producing a series of analog voltages and signaling the external circuit when the data are stable using a computer, parallel output port, and d/a converter.

Typology: Exams

2012/2013

Uploaded on 04/01/2013

saji
saji 🇮🇳

4.5

(2)

54 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name (Last, First)
UNIVERSITY OF CALIFORNIA
College of Engineering
Electrical Engineering and Computer Sciences Department
EECS 145M: Microcomputer Interfacing Laboratory
Spring Midterm #1 (Closed book- calculators OK)
Wednesday, February 26, 1997
For book- add drawing of timing diagram to problem 2
PROBLEM 1 (50 points)
You wish to measure the distance from a point on the earth to the surface of the moon using the
following components:
1A pulsed laser that can send a narrow beam of light to the moon. The laser pulse is triggered
by a low-to-high edge on a digital input line, and the laser pulse has a duration of 10 µs.
2A special (retro-directive) mirror that reflects light back along its original direction, placed on
the moon years ago by the Apollo astronauts.
3A photodetector (at the focus of a large telescope) that can detect the laser light reflected from
the mirror on the moon and produce an digital pulse that is high only when the reflected laser
light is detected.
4A computer with C compiler, similar to the one used in the 145M lab. “Import” and “outport”
commands each transfer words of 16 bits and take 1 µs- assume that all other C program
commands are essentially instantaneous.
5A counter/timer circuit at port address 1, containing a single 32-bit counter/timer that is set to
take its input from a 1 MHz clock.
All 32 bits in the counter can be set to zero using the program command
outport(1,0);
The 16 bits i1 (least significant word) and the 16 bits i2 (most significant word) can be
latched and read using the following program commands:
outport(1,1);
i1 = inport(1);
i2 = inport(1);
6A 16-bit parallel output port at port address 2. It is set to operate in transparent mode so that
the word j can be made to appear immediately on the external lines using the program
command:
outport(2,j);
7A 16-bit parallel input port at port address 3. It is set to operate in transparent mode so that the
word k on the external lines can be read at any time using the program command:
k = inport(3);
Assume for the sake of calculational simplicity that the distance to the moon is 300,000 km and that
the laser beam has a speed of 300,000 km/s.
EECS145M 1997 Midterm #1 Page 1 Derenzo
pf3
pf4
pf5

Partial preview of the text

Download Lab: Measuring Moon Distance & Producing Analog Voltages and more Exams Microcomputers in PDF only on Docsity!

UNIVERSITY OF CALIFORNIA

College of Engineering Electrical Engineering and Computer Sciences Department

EECS 145M: Microcomputer Interfacing Laboratory

Spring Midterm #1 (Closed book- calculators OK) Wednesday, February 26, 1997

For book- add drawing of timing diagram to problem 2

PROBLEM 1 (50 points)

You wish to measure the distance from a point on the earth to the surface of the moon using the following components:

1 A pulsed laser that can send a narrow beam of light to the moon. The laser pulse is triggered by a low-to-high edge on a digital input line, and the laser pulse has a duration of 10 μs.

2 A special (retro-directive) mirror that reflects light back along its original direction, placed on the moon years ago by the Apollo astronauts.

3 A photodetector (at the focus of a large telescope) that can detect the laser light reflected from the mirror on the moon and produce an digital pulse that is high only when the reflected laser light is detected.

4 A computer with C compiler, similar to the one used in the 145M lab. “Import” and “outport” commands each transfer words of 16 bits and take 1 μs- assume that all other C program commands are essentially instantaneous.

5 A counter/timer circuit at port address 1, containing a single 32-bit counter/timer that is set to take its input from a 1 MHz clock. All 32 bits in the counter can be set to zero using the program command outport(1,0); The 16 bits i1 (least significant word) and the 16 bits i2 (most significant word) can be latched and read using the following program commands: outport(1,1); i1 = inport(1); i2 = inport(1);

6 A 16-bit parallel output port at port address 2. It is set to operate in transparent mode so that the word j can be made to appear immediately on the external lines using the program command: outport(2,j);

7 A 16-bit parallel input port at port address 3. It is set to operate in transparent mode so that the word k on the external lines can be read at any time using the program command: k = inport(3);

Assume for the sake of calculational simplicity that the distance to the moon is 300,000 km and that the laser beam has a speed of 300,000 km/s.

PROBLEM 1 (continued)

Do the following:

a. (15 points) Draw a block diagram of your system, showing and labeling all essential components and connections.

b. (15 points) List the steps necessary for your system to measure the distance to the moon in units of km. Include both hardware events and program code as needed. (“Legal” C code not required- just describe what each program command needs to do.)

PROBLEM 2 (30 points)

Design a system for producing a series of analog voltages for an external circuit, and signaling the external circuit when each new analog voltage is accurate and stable, using the following components: For book, add outporb(2,k) for output data available k = 0,

1 A computer with C compiler, similar to the one used in the 145M lab. “Inport” and “outport” commands each transfer words of 16 bits and take 1 μs- assume that all other C program commands are essentially instantaneous.

2 A 16-bit parallel output port at port address 1, with “ready for output data” and “output data available” handshaking lines. It is set to operate in transparent mode so that the word i can be made to appear immediately on the external lines using the program command: outport(1,i);

3 A 16-bit D/A converter, with bit switches that take anywhere between 100 ns and 200 ns to close, and an output op-amp with a risetime of 50 ns.

4 An external circuit that “captures” its analog input only on a low-to-high edge of a digital input line (ignores the analog input at other times), and is always ready to receive these data

  • a. (15 points) Draw a block diagram of your circuit design, showing and labeling all essential components and connections.

PROBLEM 2 (continued)

b. (15 points) List the steps necessary for your system to produce a new analog voltage and notify the external circuit when the data are stable. Include both hardware events and program code as needed. (“Legal” C code not required- just describe what each program command needs to do.)

PROBLEM 3 (20 points)

A colleague (who has never taken 145M) has just designed a digital data acquisition system using a microcomputer, a digital input port with edge-triggered D-type flip-flop registers, and the following handshaking protocol:

1 When the program is ready for data, it sets “ready for input data” TRUE.

2 When the external circuit detects “ready for input data” TRUE, it pulses the input STROBE line (connected to the clock input of the D-type flip-flops)

3 The external circuit asserts data on the input lines of the port (connected to the data input of the D-type flip-flops) and makes “input data available” TRUE

4 The program detects “input data available” TRUE and reads the input port registers (the output of the D-type flip-flops)

5 The program sets “ready for input data” FALSE, processes the data, and then returns to step 1

Your colleague complains that his design does not work, and that the values read during step 4 have nothing to do with the digital input data. After carefully examining his steps, you find that two serious errors were made. What are these errors, and how would you fix them?

Ri = a + bni − Vi V rms = m^1 ∑ Ri^2

a =

strq msr^2

and b =

mqrt msr^2

where r = ∑ ni s = ∑ ni^2 q = ∑ niVi t = ∑ Vi

V ( n ) = V ref^ −^ + n

V ref^ +^ − V ref^ − 2 N

 =^ V min +^ n^

V max − V min 2 N^ − 1

n =

VV ref^ − ∆ V

INTEGER

V ( n − 1, n ) = V ref^ −^ + ( n − 0.5)∆ VV =

V ref^ +^ − V ref^ − 2 N^ − 1

H ( f ) = h ( t ) ej^2 π ft^ dt −∞

∫ e^

j θ (^) = cosθ+ j sinθ

If h ( t ) =

A for | t |≤ T 0 / 2 0 for | t |> T 0 /

, then H ( f ) = AT 0

sin(π T 0 f ) π T 0 f

If h ( t ) = 0 for t < 0; h ( t ) = Aet^ /^ τ^ for t ≥ 0 , then H ( f ) = A 1 + 4 π^2 f^2 τ^2

Hn = hke −^ j^2 π nk /^ M k = 0

M − 1

∑ hk =^

Hn M

e + j^2 π nk^ /^ M n = 0

M − 1

∑ dB = 20 log 10

Fn = Hn = Re( Hn )^2 + Im( Hn )^2 tanφ n = Im( Hn ) Re( Hn )

For hk = ai cos(2π ik / M ) + bi sin(2π ik / M ) H 0 = Ma 0 Hn = ( M /2)( anjbn ) i = 0

M − 1

fmax = fs/2 ∆t = 1/fs S = M∆t ∆f = 1/S h(t) = 0.5 [1.0 – cos(2πt/S)]

yi = A 1 xi − 1 + A 2 xi − 2 +... + AM xiM + B 1 yi − 1 + ... + BN yiN

If a ( t ) = b ( t ') c ( tt ' ) dt ' −∞

+∞

∫ =^ b ( t )^ ∗ c ( t ), then FFT(a) = FFT(b) multiplied by FFT(c)

f max =

2 N +^1 π T

V ( t ) = V (0) et^ /^ RC

V out V in

1 + ( f / fc )^2 n

n =

ln [( G 1 −^2 − 1 ) ( G 2 −^2 − 1 )]

2ln [ f 1 f 2 ]

fc = f 1 ( G 1 −^2 − 1 )

−1/2 n

= f 2 ( G 2 −^2 − 1 )

−1/2 n

N = 8 9 10 11 12 13 14 15 16

2 N^ = 256 512 1,024^ 2,048^ 4,096^ 8,192^ 16,384^ 32,768^ 65,