EECS 145M Spring 2009 Midterm Solutions - Digital Logic and Microcontroller Programming, Exams of Microcomputers

Solutions to the midterm exam of eecs 145m spring 2009 course, covering topics such as edge-triggered d-type flip-flops, transparent latches, sample and hold amplifiers, tri-state buffers, a/d converters, microcontroller display screens, ultrasonic ranging systems, and error corrections.

Typology: Exams

2012/2013

Uploaded on 03/22/2013

saryu
saryu 🇮🇳

4.3

(4)

42 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Februar 25, 2009 page 1 S. Derenzo
Solutions for Midterm #1 - EECS 145M Spring 2009
1.1 Edge-triggered D-type flip-flop:
one digital data input
one digital clock input
one digital data output
the output is set equal to the input on every rising edge of the clock
1.2 Transparent latch:
one digital data input
one digital gate input
one digital data output
the output is equal to the input when the gate signal is high
the output does not change when the gate signal is low
1.3 Sample and hold amplifier
one analog data input
one digital control input
one analog data output
the output is equal to the input when the control is set to sample mode
the output does not change when the control is set to hold mode
1.4 Tri-state buffer
one digital data input
one digital “output enable” input
one digital data output
the output is equal to the input when the “output enable” signal is low
the output is high impedance when the “output enable” signal is high
1.5 A/D converter (12 bit)
one digital “start conversion” input
one analog input
one digital “data available” output
one 12-bit digital output
Note: Vref+ and Vref are also needed, but no points were deducted if these were omitted
2 Error 1: clock input is pulsed in step 2 before input is asserted. Fix by asserting the input
before providing the clock edge (reverse second part of step 2 and first part of step 3)
Error 2: the external circuit never resets “input data available” to FALSE so that step 4 is
executed and the program reads the flip-flops over and over again, without regard for when
the external circuit asserts and clocks new data. Fix by adding a step 6 so that the external
circuit sets “input data available” FALSE when it detects “ready for input data” FALSE
[3 points off for only reversing steps 2 and 3- this sets “input data available” before the flip-
flops are clocked and could cause the program to read data too soon]
[10 points off for missing either error]
pf3

Partial preview of the text

Download EECS 145M Spring 2009 Midterm Solutions - Digital Logic and Microcontroller Programming and more Exams Microcomputers in PDF only on Docsity!

Februar 25, 2009 page 1 S. Derenzo

Solutions for Midterm #1 - EECS 145M Spring 2009

1.1 Edge-triggered D-type flip-flop: one digital data input one digital clock input one digital data output the output is set equal to the input on every rising edge of the clock 1.2 Transparent latch: one digital data input one digital gate input one digital data output the output is equal to the input when the gate signal is high the output does not change when the gate signal is low 1.3 Sample and hold amplifier one analog data input one digital control input one analog data output the output is equal to the input when the control is set to sample mode the output does not change when the control is set to hold mode 1.4 Tri-state buffer one digital data input one digital “output enable” input one digital data output the output is equal to the input when the “output enable” signal is low the output is high impedance when the “output enable” signal is high 1.5 A/D converter (12 bit) one digital “start conversion” input one analog input one digital “data available” output one 12-bit digital output Note: Vref+^ and Vref–^ are also needed, but no points were deducted if these were omitted 2 Error 1: clock input is pulsed in step 2 before input is asserted. Fix by asserting the input before providing the clock edge (reverse second part of step 2 and first part of step 3) Error 2: the external circuit never resets “input data available” to FALSE so that step 4 is executed and the program reads the flip-flops over and over again, without regard for when the external circuit asserts and clocks new data. Fix by adding a step 6 so that the external circuit sets “input data available” FALSE when it detects “ready for input data” FALSE [3 points off for only reversing steps 2 and 3- this sets “input data available” before the flip- flops are clocked and could cause the program to read data too soon] [10 points off for missing either error]

Februar 25, 2009 page 2 S. Derenzo

Micro- computer Display screen Digital input Digital output Crash alarm speaker Ultrasonic ranging system Obstacle Trigger Output

  • A trigger pulse causes the ultrasonic ranging system to emit an ultrasonic pulse and output a low-to-high edge.
  • When the echo is received, the output pulse goes high-to-low 3.
    1. set trigger output low
    2. read T1 = microsecond clock value
    3. set trigger output high
    4. set trigger output low
    5. read T2 = microsecond clock value
    6. if T2 > T1 + 200,000 go to step 2)
    7. read input port
    8. if low, go to step 5)
    9. if high, compute distance d = (T2-T1) * c/
    10. approach speed = (previous d minus new d)/0.2 sec (go to step 13) on first iteration)
    11. display distance and approach speed
    12. if (distance in ft) < (approach speed in ft/sec), sound the alarm
    13. read T3 = microsecond clock value until T3 > T1 + 200,
    14. loop back to step 2) Note: step 6) handles the case of no echo for 200 ms; it was not required for full credit [3 points off if an echo return < 200 ms will start another trigger without waiting the remainder of the 200 ms] [3 points off for not reading the microsecond clock] [3 points off for velocity = ( d 2 – d 1 )/( t 2 – t 1 ) [5 points off for not pulsing at 5 Hz] [3 points off for incorrectly calculating alarm condition] 3. t =

ti i = 1 100

σ (^) t^2 =

( t i −^ t )

i = 1 100