



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 7
This page cannot be seen from the preview
Don't miss anything!




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
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?
a =
st − rq ms − r^2
and b =
mq − rt ms − r^2
V ( n ) = V ref^ −^ + n
V ref^ +^ − V ref^ − 2 N
=^ V min +^ n^
V max − V min 2 N^ − 1
n =
V − V ref^ − ∆ V
INTEGER
V ( n − 1, n ) = V ref^ −^ + ( n − 0.5)∆ V ∆ V =
V ref^ +^ − V ref^ − 2 N^ − 1
H ( f ) = h ( t ) e − j^2 π ft^ dt −∞
∞
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 ) = Ae − t^ /^ τ^ for t ≥ 0 , then H ( f ) = A 1 + 4 π^2 f^2 τ^2
Hn = hke −^ j^2 π nk /^ M k = 0
M − 1
Hn M
e + j^2 π nk^ /^ M n = 0
M − 1
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)( an − jbn ) i = 0
M − 1
yi = A 1 xi − 1 + A 2 xi − 2 +... + AM xi − M + B 1 yi − 1 + ... + BN yi − N
If a ( t ) = b ( t ') c ( t − t ' ) dt ' −∞
+∞
f max =
2 N +^1 π T
V ( t ) = V (0) e − t^ /^ RC
V out V in
1 + ( f / fc )^2 n
n =
−1/2 n
−1/2 n