
Introduction :
==============

                A digital storage oscilloscope (DSO) is a very important
        piece of test equipment that can do the jobs that a normal CRO
        just can't handle. Such as capturing single shot and widely
        spaced waveshapes, and looking at non repetitive signals that
        can't be triggered on a CRO.

                Unfortunately the cost of DSO's put them out of the
        reach of a lot of people, which is why projects that convert a
        normal CRO into a DSO have always been popular. But these have a
        few limitations, the obvious one being that you must have a CRO
        in the first place, and not everyone has (there expensive too!).
        Most also have a small sample memory due to the limitations of a
        standard CRO screen and there is no way to permanently store the
        waveforms for future reference and comparison.

                Enter the PC based Digital Storage Oscilloscope Adapter
        (DSOA). It interfaces to the parallel port of any standard
        IBM-PC compatible and has a maximum storage memory of 32Kbytes
        (that's more than a lot of full blown DSO's), and a sampling
        rate of over 600K samples per second.

                The stored waveform is read into the PC via the parallel
        port and displayed on screen the same as a normal CRO. But being
        PC based gives the DSOA advantages such as being able to
        permanently load and save waveforms to disk, zoom in on any part
        of the waveform and superimpose two waveforms for comparison. A
        large screen display could also be useful for an audience.

                The large sample memory is particularly useful for
        seeing such things as an amplitude modulated sinewave or a video
        signal, but with a small memory the replayed signal would appear
        to have a constant amplitude or in the case of the video signal
        you won't see the 50Hz sync pulse!.

                Input sensitivity of the DSOA is fully variable from a
        few hundred milivolts to tens of volts, with selectable AC or DC
        coupling. Triggering is obtained via a manual start button or a
        positive going input level, variable from 0 to 2.5 Volts. The
        sampling rate is also fully variable from 15ks/s to over
        600ks/s. The unit has a standard input inpeadence of 1M which
        allows use of a x10 CRO probe.

                One handy feature is an overflow LED that will latch on
        during sampling if the input goes above the limit set by the
        range pot. This will show that an overflow has occurred without
        having to read the data into the computer and display it.

                The DSOA can use either a 62256 or 6264 static RAM chip
        depending on availability, this will give either 32K or 8K of
        storage. But there's not much difference in price between them
        so get the 62256 if you can.

                If a battery backed nonvolatile SRAM is used then the
        waveform will stay in memory as long as the unit is switched to
        READ mode. This is very useful as it allows you to use the unit
        away from the PC and then retrieve the waveform at a later date.

                The heart of the DSOA is the 8 bit ADC0820 analogue to
        digital converter. This is the fastest standard range 08xx ADC
        available, and can complete a full 8 bit conversion in as little
        as 1.5s by utilising a 4 bit modified 'flash' technique. It
        also has a built in sample and hold function that captures and
        stores the incoming voltage while the conversion takes place.
        There are two versions of the 0820 chip, the ADC0820B is
        accurate to   LSB, but the more common ADC0820C is accurate to
         1 LSB. However both will give nearly identical results in this
        circuit.

                This ADC chip is readily available from places such as
        Rod Irving and Geoff Wood and cost's about $20. Which is dirt
        cheap compared to most other's. It also allows for a very simple
        circuit configeration, hence the decision to use it over other
        fast ADC's such as succesive aproximation and full 8 bit
        flash's.




Limitations :
=============

                Nyquist's sampling theorem says that any signal that is
        greater than half the sampling frequency cannot be faithfully
        reproduced. This in fine in theory but when it comes to DSO's
        the input frequency should be at least 10 times lower than the
        sampling frequency to get any reasonable result. and this DSO is
        no exception.

                The maximum sampling rate of the DSOA is determined by
        the ADC with a minimum of at least 600 ks/s, but as each chip
        will be slightly different you should be able to push the speed
        further by reducing R12 to 680 or lower. Once the maximum has
        been exceeded, the effect on the display is quite noticeable as
        the waveform becomes very distorted. R12 may have to be adjusted
        one value either way depending on the exact value of C13.

                In practical use the maximum sampling rate is not as
        important as the input slew rate. For the ADC0820 chip it'self
        this is quoted as 0.1 V/s for full 8 bit resolution, although
        this isn't very important due to the internal sample and hold.
        The real problem lies in IC7b, the input voltage follower. This
        chip has no quoted spec for slew rate, but measures about 0.2
        V/s. So don't try and sample a 50Khz 2 volt square wave because
        the poor thing just can't keep up!. This could have been
        overcome by using a faster voltage follower but they are either
        hard to get or require dual supplies which wasn't worth the
        hassle.

                Basically the DSOA work's best in the audio range ie.
        upto 20kHz. Although it can operate at over double that if your
        not to interested in resolution and exact waveform reproduction.

                Another limitation of the LM358 is that the output
        voltage can only go down to about 4mV (only, WOW!). This is fine
        with an input voltage range of 2.5 Volts, as each step is
        2.5/256 = 9.8 mV . But if the range drops below about 1 volt
        then the bottom of the waveform starts to get clipped at 4mV,
        but it's not much to worry about as the rest of the waveform is
        usually more important anyway.


How it Work's :
===============

                Despite the apparent complexity of the circuit, the
        operation is quite simple thank's to the ADC0820. When S1 is in
        the store position and the reset button has been pressed, the D
        type latch made from IC8a is reset waiting for a trigger pulse
        from either the trigger button or the level triggering circuit
        of IC7a, and the ready LED will be lit. Once the latch is
        triggered the 7555 (IC6) is enabled and will start to oscillate
        at a frequency determined by VR2. This is the sampling rate
        clock that will have a range of approximately 15kHz to 600kHz.

                VR2 can be increased in value to 1M to give a total
        sample time of about 30sec which is useful for sampling slowly
        changing signals. If a longer sampling time is required then C13
        can be increased, but the clock output should not stay low for
        greater than 50uS.

                The negative edge of this clock will start the A-D
        conversion cycle which will take about 1.5s. Pin 9 of the ADC
        then goes low and will increment the RAM address counter (IC1,2)
        via IC9a which acts as an inverter.

                The ADC now takes a sample of the input voltage at pin
        1, compares it with the reference voltage at pin 12 and
        magically produces a corresponding 8 bit code on D0-D7. Pin 9
        instantly goes low which writes the data into the 62256 RAM.
        That's the end of the conversion cycle (simple huh!). This
        process is now repeated until the address counter reaches 32768
        in which case pin 8 of IC2a goes high and disables the ADC, which
        stops any further sampling and in turn stops the incrementing
        pulses from pin 9 of the ADC. The input waveform is now stored
        in the RAM.

                If at any time during this sampling the input exceeds
        the reference voltage then pin 18 of the ADC goes low until the
        input drops back. This will trigger the latch made from IC8b
        which lights the overflow LED.

                If you wish to use a 6264 RAM then just remove link 1
        and move S1b to pin 10 of IC2b instead of pin 8. This will stop
        the address counter at 8192 and everything works just as before.

                S2 can now be switched to the READ position which will
        disable the ADC completely and set it's data bus to a tri-state
        condition. The RAM will now be permanently in read mode due to
        R4. The PC can now take over the increment and reset lines for
        the address counter (pins 1 and 14 of the D25). All that is left
        to do is read the data out from each location in RAM and into
        the PC.

                Unfortunately the PC parallel port only has 5 input
        lines, which is not enough to read in all 8 bits from the RAM at
        once (although some ports do allow you to force data back into
        the output data lines, but that's another story!). The trick is
        to read in 4 bits at a time. This is done with the 74HC157
        (IC4), a quad 2 input mutiplexer which reads all 8 bits from the
        data bus and pin 1 selects which 4 bits (either D0-D3 or D4-D7)
        will be fed into the PC, simple.

                So basically the software first resets the address
        counter, selects the lower nibble and reads it, selects the high
        nibble and reads it, then increments the counter. This continues
        until all the data is read or you tell the software to stop.
        Actually the software employs a few extra routines to make sure
        that there are minimal errors when reading the data, due to
        noise etc.

                The voltage on the ADC reference pins 11 and 12 sets the
        input range that the A-D can convert. It does not have to be
        referenced to ground, so it can be set for a range of say 1v-4v.
        But in this case it is set to 0-2.5v by the voltage divider
        action of R7 and VR4. R8 and R9 divide this range voltage by 2
        which is used as the DC offset for the AC range. So on the AC
        setting the input range will be variable upto 1.25 volts. On
        the DC range the input is just fed straight though to the
        voltage follower from the input attenuator pot VR1.

                The voltage follower IC7b converts the high impeadance
        input to a low impeadance output with R10 used to hold the
        output rigid while the ADC is sampling. IC7a is the trigger
        level comparator that compares the input with the voltage from
        VR3, if the input goes above this level then pin 1 goes high and
        triggers the sampling latch IC8a.

                All of the 74HC IC's should not be substituted for other
        types such as LS if at all possible, particularly IC4 and IC9.
        Also it is not recommended that the 7555 be substituted for a
        standard 555.

                The lead to connect the DSOA to a PC is a straight
        though eg. pin1 to pin1 cable and does not really have to be
        shielded in any way (but it will help), as the software takes
        care of most noise. Ideally an unshielded lead should be kept
        under 2 metres in length.

                Power for the unit can be supplied by a 9v DC plugpack,
        or any DC supply greater than 8v. The 7805 regulator does not
        require a heatsink as it hardly gets warm. The total power
        consumption is under 50mA.



Construction :
==============

                All of the components with the exception of the pots,
        switches, LED's, and sockets are mounted on a single PCB that
        fits neatly inside a standard size jiffy box. IC sockets are
        highly recommended for all IC's particularly the ADC and RAM.

                A shielded metal case would be preferable, but a plastic
        jiffy box with a grounded metal front panel, gives great
        results. It also looks heaps better and is easier to cutout. The
        easiest way to ground the front panel is to use a solder lug
        under one the switches.

                Start construction by drilling the front panel, box and
        the cutout for the DB25 socket. The front panel label can be
        used as a drill template. Mount all the pot's, switches and
        LED's on the front panel after applying the label.

                Begin the PCB construction by mounting all the low
        profile components such as the IC sockets, resistors and links.
        Next mount all of the wiring stakes and then the rest of the
        components. The regulator does not have to be bolted to the PCB
        but it makes the board look much neater. Watch the orientation
        of the polarised capacitors.

                The whole unit can now be wired up according to the
        wiring diagram. None of the wiring has to be shielded, although
        they should be kept as short as possible to once again avoid any
        noise problems.

                Before inserting any IC's the unit should be powered up
        and checked that there is 5v going to each socket. Then make
        sure all the IC's are inserted the right way around, after
        turning off the power of course!.



In Use :
========

                To store a waveform the DSOA must be disconnected from
        the PC or if it is connected the software must be running. This
        is to ensure the external reset and clock lines don't interfere
        with normal operation.

                First select the STORE mode and then the trigger level
        required from 0-2.5v. If you wish to trigger the sampling
        manually then set the trigger level to maximum.

                If the input frequency and voltage can be anticipated
        then the attenuation and sample rate can be set so that a decent
        waveshape is recorded on the first attempt. But if you wish to
        sample an unknown waveform then it may take a few attempts and
        adjustment of the attenuation and sample rate to get a good
        result.

                The best way to sample an unknown waveform is to set all
        the controls to maximum, press the reset button and start
        sampling with the manual start button or trigger control. If the
        overflow LED lights then reduce the LEVEL control and try again.

                Try to keep the RANGE control near maximum as this will
        give a better quality waveform. But if the input is less than 1
        volt then the RANGE control may have to be turned down
        significantly to keep the waveform close to full scale. In this
        case the replayed waveform will have a bit of noise, but it is
        usually under 10 LSB's in amplitude which is not all that bad.

                By using the combination of the LEVEL and RANGE controls
        it is possible to store an input signal ranging from a few
        hundred millivolts to tens of volts full scale. A x10 CRO probe
        can also be used to divide large signals by a factor of 10.

                After the unit is triggered and the READY LED turns off,
        wait a few seconds for the sampling and then switch to READ
        mode. If a nonvolatile or battery backed RAM is used then the
        unit can be safely switched off and transported. The waveform
        can now be read into the PC for analysis.

                Try to keep the unit away from electromagnetic fields
        such as the computer monitor when sampling, or noise can be
        introduced onto  the waveform.



The Software :
==============

                The software is the key to the whole project, by
        providing the means to read the waveform from the RAM in the
        DSOA and display it on the screen.

                When the program is loaded it checks for the type of
        graphics adapter installed and configures it'self accordingly.
        It will work with Hercules/CGA/EGA/VGA graphics cards, but
        Hercules requires MSHERC.COM to be loaded first.

                CGA is not recommended because with a vertical
        resolution of only 200 pixels, the 256 points on a waveform are
        commpressed down to about 150 pixels on the screen. But it still
        gives quite acceptable results. With any other type of adapter
        the waveform is displayed with at least 1 pixel per LSB.

                After graphics initialisation a main menu apears with 10
        options. If the DSOA is connected to LPT2 or an MDPA port then
        it must be selected with option 6 otherwise the default setting
        is LPT1. Select the size of the waveform you wish to use with
        option 7. It can be either 2k, 8k or 32k which accomodate the
        different RAM sizes. The 2k setting is useful for quickly
        reading in a waveform. This will also determine the file size
        when waveforms are transferred to disk.

                Two waveforms can be loaded seperately into RAM at once.
        Option 8 selects either waveform 1 or waveform 2, and this will
        determine what waveform is loaded, saved to disk and read from
        the DSOA.

                To retrieve the waveform from the DSOA select option 1
        which will display a progress bar graph as the data is read in.
        Note that the 32k setting may take some time to load in
        depending on your machine.

                Option 2 plots the first 640 points of the currently
        selected waveform. There is a scroll bar below the waveform that
        shows the current "window" position along the waveform that is
        being displayed. This can be scrolled with the arrows keys but
        the ENTER key must be pressed to redraw the window. Press "X" to
        expand or contract the size of the current window, with the
        maximum value dependant on the RAM size setting.

                Pressing "1" or "2" selects between the two waveforms,
        or "D" displays both at once, which is handy when comparing two
        waveforms.

                Note that it is not easy to determine any time values
        from the screen unless the sample rate is known. The same also
        applys to the amplitude. This is one limitation of having
        variable input and sample ranges, but it is usually more
        important to know what the waveform look like!.


                So there you have it, a complete PC based DSO that will
        be a valuable addition to your collection of test equipement,
        with applications that are only limitied by your immagination.

