Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Digital Signal Processing (Part 1)

Article from Electronics & Music Maker, July 1983

The first of an innovative new series on musical applications of your home micro


PART 1. Data Acquisition and Storage with Programs for Storage Oscilloscope and Frequency Meter.


Two major E&MM projects, the Digital Delay and Transpozer, use digital signal processing techniques. That is, an audio signal is converted into digital form, temporarily stored in memory and then reconstituted to analogue form. The most complicated part of these projects is the manipulation of the signals through the memory so as to provide the many effects. The complications arise because the manipulation has to be controlled with hardware, eg, switching delay time and so on.

An alternative approach is control of the signals using a home micro and software this being the object of the current project. Naturally some additional hardware is required to get the signals in and out of the micro, as well as conditioning of the signals at different stages, although once captured the signals may be manipulated in many different ways. In this first part, signals may be put into the memory of the micro and then displayed on the screen using a storage oscilloscope program which provides capture facilities not found on very expensive oscilloscopes — such is the power of the micro (or the programmer)! The program, together with hardware also allows frequency measurement of waveforms. Other programs will be made available to take advantage of the present hardware and its subsequent additions.

In fact the series was prompted by the editor's final comment in his review of the Prophet 600 synthesiser (E&MM April 1983) which stated — "so now's the time to learn to use a home micro or you'll be left behind." Our aim is to provide flexible hardware together with sophisticated software which is accessible to the user. In other words, some immediately useful equipment and software which may also serve as a base for experimentation of either, or both, aspects. Clearly the emphasis will be on the processing of music but other signals are catered for by the hardware. Another objective is to explain some of the mysteries which surround digital processing techniques, for example, what is aliasing and how is it avoided? Such questions will be answered in a manner which allows the user to both see and hear the effects. We feel the latter will be more helpful than a strictly technical description.

Figure 1. Block diagram of the Digital signal processing project.


The basic signal processing scheme used in this series is shown in Figure 1. First there is a general purpose interface combined with a high speed analogue to digital converter and which connects in close proximity to the microprocessor. This interface may then be expanded by mounting other boards, sandwich fashion using PCB mounting pillars, with one such board being a digital to analogue converter. The arrangement simplifies connection of various devices to the general purpose interface.

One of the biggest problems in presenting this project was that of choosing a home micro. The choice was eventually dictated by popularity, that is, a micro which many readers may already possess or which, if purchased now, still represents good value for money in terms of programming capability. The micro used is the Sinclair 'Spectrum' even though it must rank as one of the least satisfactory machines for input-output routines. Furthermore, while it is a major achievement to pack such computing power into half a pint, in reality after adding a power pack, cassette, TV and printer it occupies more bench space than far more powerful units. There also seems enough spare cable around to re-write the house! Now we need to keep the interface close to the Spectrum so as to avoid problems of corrupted data but in order to keep the rest of the equipment away from the general clutter around the micro a number of controllers have been provided and these may be located a metre, or more, away.

The first controller, which is fully described in this article, has provision for accepting a very wide range of analogue inputs. For example, it will accept AC and DC signals in the range of about 5 millivolts to 50 volts and twelve ranges may be chosen by switching. There is also an input for a synthesiser keyboard along the lines described in earlier issues of E&MM. In other words a wide range of data (voice, music, transducers, etc.) may be conditioned prior to being input into the memory of the Spectrum. Once collected the data may be analysed and manipulated in many ways prior to being output tp screen, printer, cassette or converted back into analogue data with a digital to analogue (D/A) converter. The latter forms the other major module of the system and it has provision for mixing of treated and original signal as well as providing a feedback path. These facilities will allow the micro to be used for large scale digital delay techniques. Filters will be included with both the A/D and D/A controllers so as to remove aliasing effects and quantisation noise. This combination of hardware allows many sophisticated software programs to be developed.

Selecting, Connecting and Powering



As stated above the system described here utilises the Sinclair Spectrum. The 48k version of this micro is virtually essential for this project since the 16k version has little memory space available for the storage oscilloscope program and certainly insufficient for echo effects and the like. Additionally, the Spectrum has some complex refreshing techniques and while some of these may be disabled during running of machine code programs there are others which still interfere with fast data acquisition. One of the effects observed is that a stored waveform will yield an uneven display and this has been avoided in the 48k version of the storage oscilloscope program by placing the program above the basic 16k. Nevertheless a 16k version of the latter program will be provided since the unevenness is tolerable and is outweighed by other benefits of the program.

Having stored a sample in memory one may well wish to make a permanent record of waveforms and other data collected and this is easily achieved with a Sinclair ZX Printer. To accommodate this and the requirement for a short connection referred to earlier we opted for a flexible link between the edge connector at the rear of the Spectrum and the interface board. Another PCB which is soldered into the wire wrap connector allows the printer, or other peripherals, to be plugged in. The Spectrum outputs provided are: 0V, D0 to D7, A0 to A7, RD, WR and IORQ and so may be used for other projects, such as the OMDAC published last month.

From the above it will be evident that we are not using any power from the Spectrum. No spare capacity is available from the regulated supplies and while the +9V unregulated supply could be used the amount of spare capacity would depend on other demands, such as the printer. Consequently the equipment requires an external supply of +5V and +/-12V although a +/-15V supply may be substituted for the latter after making changes to the values of a few of the resistors. So as not to add unduly to the number of wires the external supply is only connected to the interface PCB and the small amount of power required by the control boxes is taken via their connection to the interface. The power supplies used area 600mA +5V supply and 75mA per rail +/-12V supplies. They use conventional regulator and are not described in detail in this article since they are supplied with full constructional information. The supplies may also be housed in the same type of case used for the controllers. This housing has been arranged so that it leaves an area of about 100 x 160 mms on the top, this space being ideal for adding some breadboard to provide a self-contained prototyping area.

Figure 2. Circuit diagram of interface.
(Click image for higher resolution version)


The Interface



The circuit diagram for the interface with the micro is shown in Figure 2 and much of it will be familiar to E&MM readers since the 8255 Programmable Peripheral Interface (PPI) has been used in several recent projects. The advantages of this approach are: low cost provision of three 8-bit ports; ease of programming; and not least a capability of making use of both software and hardware with other micros of the Z80/8080 families. The disadvantage of the approach in combination with the Spectrum is that it is relatively slow. Even with an efficient machine code sampling routine our measurements indicated the maximum sampling rate to be in the range of 12 to 15kHz. This means, for reasons to be discussed later, that realistic reproduction is limited to a bandwidth of below 6kHz. In practice this is adequate for most applications and so the advantages were accepted.

The analogue to digital converter IC used is a ZN 449 and is connected to Port B of the PPI. Port A will be used for the D/A converter while Port C is split such that PC0 to PC3 are arranged as outputs while PC4 to PC7 are set up as inputs. This latter port is used for specific functions which will be described as they arise. The ZN 449 is a successive approximation A/D converter with a 9uS acquisition time which would allow a sampling rate in excess of 100kHz under the right conditions. The conversion cycle is initiated by a low-going Start Conversion pulse to pin 4 and this pulse is software generated using PC3 output (pin 17) of the 8255. Within nine clock pulses from the start the IC will put valid data on its bus. The ZN 449 has a three-state output but in this application it is kept open by tying the RD line (pin 2) to ground, when the conversion cycle is complete then pin 3 (BUSY) goes high and this is connected to PC7 of the PPI although it is not utilised at this time. If the actual sampling rate achieved was approaching the capability of the IC or the reading of data was not synchronised (by the software) with the start conversion pulse then the BUSY signal could be used to interrupt the micro to prevent it reading incomplete (incorrect) data.

The ZN 449 has an on-chip clock and in its simplest form only requires a capacitor, C8, attached to pin 3. The data sheet suggests that a 100pF capacitor will yield the maximum clock rate of 1MHz but in practice a smaller value is required to ensure this speed. It also has its own 2.5V reference voltage and components R6 and C9 connected to pins 7 and 8 make use of this internal reference. R5 connected to -12V is to supply the tail current to the internal comparator.

The analogue input is connected to pin 5 and R2 and R3 have been selected for a bipolar input range of +/-2.5 volts (facilities are available in the A/D controller to give a unipolar response — see later). R4 shown in the circuit diagram is not installed although there is space for it on the PCB since its installation allows users to alter the range, if they wish.

Completed Interface PCB with connector


A successive approximation A/D requires a stable reference voltage and at each of its conversion steps it makes a comparison between the reference voltage and the input voltage in order to decide whether the bit will be set to '0' or '1'. If, however, the input is changing in voltage during this conversion period then it is obvious that accuracy will be lost and distortion will occur. The extent of the latter will depend on the acquisition time of the converter in relation to the frequency of the input and so the error is not very significant with the present rates. It can, however, be avoided by 'freezing' the sample during the conversion step using a sample and hold amplifier and this facility is provided. Two input channels, A and B, are also included on each interface board and these in turn are connected to analogue switches IC4a and IC4b (note that the DG 211 analogue switch will accept bipolar signals within the +/-12V supply range while responding to normal +5V logic levels). As already noted, the BUSY line goes low at the start of conversion and this signal is inverted by IC2c so as to close the switches during the conversion stage.

The analogue signal level at the start of conversion will then be held on C10 and/or C11 at IC5a/IC5b. Since the A/D can only deal with one sample ata time Channel A or Channel B is selected by the software using ports PC0 and PC1 connected to IC4c and IC4d. This arrangement allows the signals to be software switched alternately between Channels A and B and so provide a dual storage oscilloscope facility.

Figure 3. Circuit diagram of A/D controller.
(Click image for higher resolution version)


Analogue to Digital Controller



The circuit diagram for the A/D Controller is shown in Figure 3 and a common input at J1 may be routed via S1a to one of three signal paths, ie AC, DC or KB (keyboard). The AC input should be used with all audio signals; the DC input used for outputs from transducers used to measure temperature, light, sound, etc. as well as for DC inputs such as envelope generators and the like; and the keyboard input is for sequencing techniques as already published in E&MM. As stated above, the A/D is set to respond to a +/-2.5V input and since an 8-bit converter provides 256 different digital steps this amounts to about 20mV/bit. Thus if the input to the A/D is a signal fluctuating from 0V to nearly 40mV then the resolution will not be adequate because the output would be a two bit stepped response and most of the information about the signal is lost. Likewise with the storage oscilloscope program the display would be a slightly wavering line — as it would be on a conventional oscilloscope if the amplifier was wrongly set. It is therefore desirable that the signal to the A/D on the interface board is amplified, or attenuated, such that it will utilise the full scale. There are several reasons for choosing a switched attenuator network in order to meet the latter requirements and not the least of these is that it provides reliable and useful information on the voltage levels of the input signals. The network built around S2a and S2b allows twelve switched levels having full scale response between 10mV and 50V in steps of X1, X2 and X5. Input impedance is about one megaohm but since frequencies will normally be in the audio range no special screening precautions are employed although AC inputs to the controller should be via a screened cable connector. Diodes D1 and D2 protect circuitry against excessive voltages. The low level signals are amplified by IC7, having a gain of 28, before being routed to S3 which provides a zero voltage setting to allow accurate setting up of the A/D converter scale. From S3 the AC/DC signals are routed to IC2a which is arranged as a inverting amplifier with a gain of 17.85 giving a total gain of 500. The keyboard signal goes direct to IC2a via R29 and RV1. The non-inverting input of this latter amplifier is switched by S1b to provide the required voltage offsets; for AC signals RV3 is adjusted such that 0V gives a reading of 128 from the A/D; the DC has an offset potentiometer RV4 which may be adjusted such that 0V or the lowest DC input (within reason!) will produce a reading of 0 from the A/D; and for the keyboard input RV2 is similar to RV4 insofar as it may be adjusted for DC offsets of a particular synthesiser keyboard. Because the latter needs to be stable a separate multiturn trimmer is used rather than combine the keyboard and DC offset adjusts.

We also mentioned earlier that the frequency of any input signal should not be higher than half the sampling rate. This should not be interpreted as meaning that one may input a sawtooth waveform of 6kHz into the controller. What it means is that the signal should not contain any frequency components in excess of 6kHz, or at least these higher frequencies must be very low in amplitude relative to the main signal. Failure to comply with this requirement will result in foldover distortion due to aliasing of the input frequency with the sampling frequency. This is a very important aspect which is often ignored in similar designs. To cut out, or attenuate, these higher frequencies one uses what is termed an 'antialiasing' filter which is simply a low pass filter with a sharp cut off response. A four pole (24dB/octave) low pass filter whose cut off frequency may be varied from 20Hz to 20,000Hz will be included in the project and the user will then be able to see and hear the effects of aliasing and study the importance of signal conditioning. In Figure 3 the filter is simply shown as a box and its temporary absence does not prevent the use of the equipment for a wide range of applications (the only restriction is the frequency components in the signal). For DC and Keyboard inputs the filter may be (and should be) bypassed by S4. All signals, bypassed or filtered, go to IC8b where they are reinverted to their original polarity prior to being sent to the A/D converter on the interface board. D3 and D4 prevent excessive voltages reaching the ZN 449. When the filter is switched into circuit and serving its purpose of removing unwanted upper frequencies it will also reduce the power (voltage) of the signal. Consequently the output of the filter goes to IC8b via R43 which provides an additional gain of two. The filter also has provision for converting it into a sine wave oscillator so that its oscillating (cutoff) frequency may be measured using the frequency measuring hardware/software. When oscillating the output from the filter enters IC8b via R44 to avoid clipping.

Internal construction of the A/D Controller


The final part of the circuit consists of comparators built around IC9 and IC10. The former will go high on receipt of a positive going signal greater than 1.1V while IC10 goes high when its input voltage falls below 1.1V. These are used for detecting positive or negative gate signals from synthesisers and the type of gate in use is selected by S7 to go to PC6 of the 8255 on the interface board. Zener diodes connected to the strobe pins (pin 8) of IC9 and IC10 clamp the output to meet 5V logic levels. The positive gate input, J2, serves a dual purpose, ie, the output from IC8b going to the A/D converter may also be routed to IC9 using S6 and so allow the frequency of the signal to be measured using the program provided. This input will be disabled when a jack plug is inserted into J2. Furthermore, S6 should be open when a signal is being sampled since D5 will clip the negative part of an AC signal (D5 prevents damage to IC9 which is operated from a single supply). Finally, S8 is a push button to enter a 'Rest' signal in sequencing operations and this signal is connected to PC6 of the PPI.

Construction



1. Connector. Insert the 28-way edge connector into the PCB marked uP1 and with the PCB evenly towards the body of the connector solder the two parts together. Now bend the exposed ends of the pins so that they meet evenly and then slide the edge connector PCB, uP2, between the two rows and ensure that each pin lines up with a finger on this PCB and that the cut-out is in the correct location. Push the PCB against the rear of the connector and solder in place. Do not let solder flow closer than 1cm. from the exposed edge of this PCB otherwise it may interfere with proper location of the printer and other peripherals on this edge. There is in fact adequate distance for soldering so this is merely a warning and not a likelihood. The next step is to prepare a strip (maximum initial length of 15 cms.) of 20-way ribbon cable by separating the individual wires some 15mms at each end and then stripping away about 3-4mms of insulation from each wire. Solder one set of 20 wires to 20 Molex pins and then insert the latter into 2 x 10 way Molex shells. The other end of the cable has to be soldered to the connector PCB, uP1. It is advisable to twist the individual strands of each wire together and then lightly solder them prior to insertion into the PCB holes. This procedure will reduce the risk of having loose strands which may touch at some later date. The sequence of connections at the top of uP1 line up with the connections on the appropriate edge of the interface PCB. Thus hole 1 at one end (does not matter which) of the connector PCB lines up with pin 1 of the Molex connector PCB lines up with pin 1 of the Molex connector and all the way along until hole 20 matches up with Molex pin 20. Carefully inspect the PCB for shorts between tracks since these will cause malfunction of the Spectrum.

2. Interface. This is a double sided PCB but all connections between sides are made using 'track pins'. Insert a track pin into every hole connected to track on the component side of the PCB. These pins are in a strip of about 50 so they may be pressed into the hole and individual pins snapped off by holding the pins close to the PCB. Solder the pins on both sides of the PCB and on the top side ensure that the solder is on both pin and track. If one loses a few track pins in the process then a short piece of tinned wire may be used to connect the sides of the PCB. Next install and solder components in the sequence of increasing height, eg, resistors, DIL sockets, capacitors and so on. The component layout is shown in Figure 4. Take care with orientation of C4 and C5. Note that the DIL sockets in the kit also show the pin numbers and so it will be helpful to orientate these in accordance with Figure 4. Next solder the Molex pins in place. These are: 2 sets of 10 in series which are used to connect the Spectrum; 2 sets of 1 (3 for the Channel A and B connections; and one set of 6 at the rear of the board for connecting the power supplies. Ensure that the holders for the pins are flush with the PCB and that the pins are straight — start by soldering one pin at each end and then check before soldering the remainder. Rubber feet are then screwed to the four corners of the PCB. Four 4mm holes in the PCB will be evident and these are for later use to secure other PCB's using mounting pillar.

Figure 4. Component overlay of interface.
(Click image for higher resolution version)


At this stage, carefully check both sides of the PCB for solder splashes and the like which may be causing shorts between tracks or pins. If practical connect up the power supplies to this board (nothing else connected) and check the voltages to determine that there are no shorts in the power lines. The supplies may be checked at the Channel connectors. If all is satisfactory then remove the power supply and insert the IC's while taking care not to bend any pins under. Also double check orientation.

Figure 5. Component overlay of A/D controller.
(Click image for higher resolution version)


3. Analogue to Digital Controller. The component lay-out of the PCB is shown in Figure 5. Note the construction procedure and precautions given above. The last components to be soldered in place should be the two PCB mounted wafers of S2. The PCB side of the wafers face the rear of the PCB (the rear has the connections to the interface PCB). Ensure that the wafers are evenly seated prior to soldering all pins. Next take the shaft assembly and only leave the two brass spacers in place. Insert the assembly into the wafers and mark off the excess length, ie, it should not protrude beyond the rear of the PCB, and after removing it from the wafers carefully saw off this excess. Now assemble the switch in the following order of parts starting from the front: brass spacer; first wafer soldered to PCB; plastic spacer; nut to secure spacer; nut as spacer for second wafer; second wafer soldered to PCB; plastic spacer; final securing nut. The switch also serves to secure the PCB to the panel but before bolting to the panel the 'end stop' washer must be removed to allow the required 12 positions.

Figure 6. Panel wiring for the A/D controller.
(Click image for higher resolution version)


Although S2 saves a great deal of wiring there are still a fair number of connections to make because of the capabilities provided. The wiring diagram is shown in Figure 6. It may be easier to estimate the length of connecting wire and solder these to the PCB before it is secured to the panel but this procedure is not essential. At this time the filter is not installed and so switch S5 (part of filter kit) cannot be wired up. Nevertheless, the wires from R43 and R44 can be prepared so long as their free end remains insulated.

Connection of the controller to the interface is by means of 10-way ribbon cable which may be of any reasonable length — a metre is suggested. First make a small slot in the rear of the case on the curved part and starting 13 cms from the left with the top towards you. The slot need only be about 12 mms long and so can be made by drilling a row of holes 2-3 mms. in diameter and cutting between them or else drilling one hole and cutting the slot with a hacksaw fitted with a tension file. As before, separate wires, strip insulation and solder one set of ends to Molex pins. Pass the other end through the slot in the rear of the case and make the required connections. Again the sequence of holes in the controller PCB matches the sequence on the interface PCB and so the cable does not have to be twisted or wires crossed over — refer to Figures 5 and 6.

4. Connecting Up. All power off. Push the edge connector onto the fingers at the rear of the Spectrum. Connect printer or other peripherals, as available or required, to the new connecting edge. Plug in the two 10 pin Molex connectors to the appropriate edge of the interface board. One problem with fully utilised Molex connectors is the danger of misplacing them by one pin. It is easily done but the error is also easy to see, so check it! Connect the 10 pin Molex from the A/D Controller to the Channel A input pins, which are the set closest to the outside edge, and then connect power supplies to the 6 pin Molex at the rear of the PCB. The latter two sets of Molex have spare pins and so as an additional safety precaution these spare pins may be snipped off and the corresponding hole in the shell filled up. This overcomes the danger of reversing connectors but again a little care will achieve the same objective.

Note that if one wishes to use Channel B input then another A/D Controller may be used. Alternatively, the input can come from some other (home brew) source so long as precautions are taken to avoid excessive voltages, say +/-3 volts maximum. Switch on power in the following order: Spectrum power supply; TV; cassette; system power supplies (simultaneously +5V and +/-12V) or else connect all to a common power switch so that everything goes on together. Note that if the signal inputs to the system are coming from a separate mains powered unit then it is desirable to switch this on before loading the program since mains switching transients frequently result in a program crash. Switch all power off before disconnecting any item of equipment although, of course, signals may be plugged into the A/D controller with the power on.

Tuning adjustments are dealt with in the next section and at this time set RV3 and RV2 (if fitted) to about mid position.

A/D Controller unit


Analogue and Digital Power Supply


In Use



Switch on power as described above. The TV should display the usual copyright message but if there is a black display in the centre or a patchwork pattern then switch off immediately, disconnect interface, switch on again and if micro is now working normally then look for a short in the system after turning the power off again. Although the likelihood of permanently damaging your micro is very small we strongly recommend thorough checking before the system is powered up. With a normal response then proceed as follows which assumes that a suitable AC signal is available, eg, from a synthesiser or other musical instrument: switch to AC input; set scale switch to the voltage range you expect — the system is fully protected against bad guesses but for reasons of safety no input in excess of 50 volts must be connected; set 'zero', 'f test', 'filter' and 'osc.' switches to the up (off) position.

Select the cassette side having either the 16k or 48k program 'DIGISCOPE III' according to the memory capacity of your Spectrum and load it by entering LOAD "". When loading is complete the first page of the menu will appear together with a flashing message 'PRESS ANY KEY TO CONTINUE'. Pressing any key will take you to page two of the menu while pressing any key once more will present you with a blank oblong with a flashing 'L' below which is waiting for your menu selection. After a load you may either enter 'f' for frequency measurement or 'sample' to start the acquisition routines. It is only necessary to enter the command, not the additional quotation marks, while the alphabetical responses are in normal lower case letters. At this time we enter 'sample' followed by pressing ENTER (as in normal operation ENTER must be pressed at the end of each command and this is assumed in the following text) and the following message will appear 'DO YOU WANT NEW PARAMETERS? Y/N'. For the first time after loading the answer must always be 'y' but for successive samples if we do not wish to make any changes then 'n' will initiate taking of the next sample. After a 'y' a series of questions will be presented and your responses to these questions will be summarised in the screen display. The sequence of questions is:

1. SAMPLE NAME "L". Should be less than fourteen characters.

2. VOLTS FULL SCALE "L". For reference enter setting of S2 but keep characters to two digits, eg., enter 20mV as '02'.

3. SAMPLE RATE. This is in Hertz and the maximum is set to 12000Hz, as discussed earlier. When the filter is fitted we will be able to enter wideband signals since high frequencies may then be attenuated. Until then the signal should not contain frequency components greater than half the sample rate entered. A little experience goes a long way with this response. For example, if one enters a very low rate to capture a slow signal and combine it with a large storage area then sampling can take many minutes and the system will seem to 'hang' and not respond to any keys (it is carrying out a machine code routine). If this is done by mistake then you have the option of being patient or switching off power and starting again. Although the program is quite friendly there will be other occasions when a wrong command may cause an error message or halt the program. Try ENTER, or BREAK followed by ENTER, and if back in Basic then RUN 3 or GOTO 3 will put you back to the menu without having to re-load.

4. TRIGGER LEVEL 0-5V. The trigger level is software controlled and when the system is used in the oscilloscope mode it provides some extremely useful features which the user should explore. One special feature is a 'circular' piece of memory which provides for 256 bytes (samples) or pre-trigger storage irrespective of when triggering occurred. The pre-trigger sample length may be altered in the machine code routine. It is obvious that the capture of events prior to actual trigger level may be extremely useful for investigating transient phenomena. The response required is a voltage and any voltage in excess of the set value will start the storage in the post trigger area. We are, however, catering for both AC and DC waveforms and the scale is in 'DC' units. Thus 0V AC is equivalent to 2.5V at the ZN449, ie., the centre line value. When this input is being used to capture transients then the required peak may be entered and the micro can sit there unattended waiting for the capture to occur. If, however, the trigger level is being used for normal synchronising purposes and too high a value is entered then the system will hang. This may often be rectified by switching S2 to a lower setting.

5. A OR B INPUT "L". Both channel inputs may be connected but in the single trace mode one must be selected. Channel A is selected by default, ie., pressing ENTER will set the system for Channel A.

6. POST-TRIGGER BLOCKS. In the recommended 48k version one has some 30k of memory available for storage/processing. All of this may be used for storage and it is divided into 120 blocks of 256 bytes (samples) and so the response to the question should be a whole number from 1 to 120. Reverting to an earlier comment, if one enters a 100Hz sampling rate and 120 blocks of memory then it will take over five minutes to load. While the latter is very useful in some circumstances it is a tedious when not required so get into the habit of entering the number of blocks you actually need.

When ENTER is pressed after responding to the 'post-trigger block' question the parameters will be entered (long BEEP) and post trigger sampling will commence as soon as the trigger level is reached (immediately if 0V is set). When sampling is complete there is a short BEEP and a flashing "L" will appear below the display area waiting for your instructions. These instructions are discussed and illustrated below and although a prose style is used the menu headings will appear above the paragraph which explains them.

Calibration "cal"



First, we revert to setting the trimmers and it should be realised that we in fact needed to go through the above steps in order to open up the signal path between the A/D converter on the interface board and the external signal connected to whatever channel was selected (remember the sample and hold!). So type in "cal" (calibration). Input should be on AC and 'zero' switch put on. The screen will now display the message 'ADC OUTPUT=xxx' where 'xxx' is a number between 0 and 255. The number is updated once a second. Adjust RV3 to obtain a reading of 127/128. For the DC mode RV4, offset, may be used to set the A/D to 0 with a 0V input ('zero' switch on). RV4 may also be used to set other offset values. The settings of RV1 and RV2, when fitted, are dealt with separately in relation the sequencing program but RV2 removes DC offset from an external keyboard while RV1 sets the input to give a 1 bit increase per semitone. To terminate calibration press any key until the quotation marks appear below the display area. The parameters entered after'sample' are still valid and in fact there should be a sample in memory if a signal input was connected.

Post Trigger, "post"



Figure 7a. Ringing.

Under normal circumstances the screen is capable of displaying 250 samples (bytes) at any one time. Assume we are not making use of the trigger mode then entering the instruction 'post' will plot out the first 250 bytes of memory starting at 256 bytes (remember pre-trigger occupies 0 to 255). This is illustrated in Figure 7a which shows ringing induced by a pulse waveform in a high Q filter. 120 post-trigger blocks were entered and so we have some 122 screens full of information which is in memory and not displayed. In this example we expect the memory to contain the same signal but if we wish to inspect the rest of the sample there are several approaches.

Scroll, "scroll"; Scroll, "s"



Press "s" and the start location will move from byte 256 to 266 and the memory contents will be plotted out from this new location. This default value of 10 is useful when positioning waveforms on the screen but to plot out the whole memory at this rate would in fact take a couple of days!! An alternative is to enter "scroll" and two lines appear below the display area:

OLD SCROLL VALUE 10 (or whatever current scroll value is)
NEW SCROLL VALUE

We could therefore respond by entering a new value of 250 which will allow us to examine the whole of memory a screenful at a time. After entering the new scroll value we then use "s" as before to move location in steps of 250 (or whatever was entered). Even with a step of 250 it would, however, take a few hours to examine all of the memory — assuming a complex screen plots takes about a minute to complete.

Start "st"



Another method would be the use of the instruction "st", or start, which will prompt the message 'ENTER-NEW START'. One may therefore enter a value which will allow the memory to be examined, starting at the location entered. Other uses of this instruction will be evident and a further illustration is given later.

Expansion "e" ; Contraction, "cont"



Figure 7b. Expanded, X3.

In Figure 7a we see at the top left hand corner 'EXP 1' which denotes an expansion of 1. With high frequency waveforms it is often difficult to discern the amount of detail which may be required. The instruction "e" prompts the response 'EXPANSION'. In Figure 7b we have entered a value of 3 so that the ringing may be examined more closely (the start has also been moved to 270 to better locate the display). Note that the expansion procedure is a plotting technique. Another facility is shown by entering "cont", contraction.

Figure 8. Bandpass filter response.
Figure 7c. Contracted, ÷3.


Figure 7c shows Figure 7a contracted by a value of 3 (refer to line 3 of display parameters) so that we now have six pulses instead of two. The contraction instruction has many uses. In Figure 8 we have a voltage controlled band pass filter whose frequency control is being swept by a sawtooth oscillator. Using a 12kHz sample rate and all of the memory we have a little more than two seconds of storage and so by setting the sawtooth below 1Hz we can be sure of getting at least one sweep in memory without having the problem of synchronising responses. To locate the response we can simply set "cont" to 120 which results in a sample from each block of memory being displayed. Knowing that we have a linear scale up to 30,000 it is not difficult to zoom into the area of interest using the "st" instruction. In Figure 8 it will be noted that the display commences at 5000 and has a contraction value of 20 which allows us to show the complete sweep in a single display. Contraction is, however, a memory sampling technique and so a contraction of 10 will in fact display the same aliasing effect as may occur with a sampling rate ten times slower than entered. The instruction must, therefore, be used with care and while it may be used for capturing sound envelopes the envelopes must be of short duration and/or of low frequency content. Such an envelope directly sampled via a microphone into the controller input is shown in Figure 9a for the word 'no' while Figure 9b with a smaller contraction shows the speech waveform.

Figure 9b. Waveform of the word 'No'.
Figure 9a. Envelope of the word 'No'.


The step size for SCROLL, EXPANSION and CONTRACTION remains until it is changed or until the program is re-run or reloaded. Remember also that an expansion of 10 will not counteract a contraction of 10 due to the different procedures used although a combination of expansion and contraction may be used to obtain a good display.

Figure 11. 'Piano' ADSR envelope.
Figure 10. Charging a capacitor.


Pre-trigger, "pre"



A few samples of the power of the pretrigger will be helpful. Figure 10 shows the charging up of a capacitor via a resistor using the DC mode. A trigger value of 0.5 volts was set and by printing out the memory from location 0 (0 to 255 is the pre-trigger area) then the whole charging cycle from 0V is captured. A contraction of 12 (or less) allow the complete charging cycle to be displayed. The same procedure was used to display envelope generators, eg., Figure 11 shows a 'piano' type envelope as described in the December 1981 issue of E&MM. Figure 12a is a more powerful example with the trigger level set to 4 volts and the scale switch, S2, set such that the waveform will not start the triggering. To initiate the trigger the switch was taken up to the next step and one can clearly see the break before make action of the switch as the output goes to zero. When the switch makes contact a spike is generated before the input settles down. A contraction of three and a start of 0 (obtained by entering "pre" when sampling is complete) shows the whole pre-trigger memory plus two screens full of post memory. Again we can zoom in on the switching transient and Figure 12b with an expansion of five illustrates this.

Figure 12b. Expansion of switching transient.
Figure 12a. Pre-trigger test.


Print, "print"; Save, "save"; Load, "load"



After the waveform has been displayed on the screen it may be printed using the Sinclair ZX Printer by using the "print" instruction. The illustrations shown in this article were produced in this manner. A "save" instruction allows information (sample) in memory to be stored on cassette for future record or for subsequent manipulation. 'Load', assuming an appropriate sample on tape, allows saved data to be back into memory.

Dual, "dual"



Figure 13. Dual trace mode.

A dual trace mode is provided and this may be entered direct from the menu or after initialising the sample code. Entering 'dual' will yield the same response concerning changing parameters. Signals must be connected to both Channel A and Channel B inputs to make use of the 'dual' facility. The mode has been somewhat simplified insofar as no pre-trigger facility is available and only one block of memory is used. Responses to these questions are therefore ignored and as a result of the changes plotting will commence immediately following acquisition of the sample and Channel B will be plotted after the plot of Channel A. The signals use the same screen area but adjusting voltage levels allows physical separation as shown in Figure 13. Note that the filtered sawtooth shown is not in phase with the sinewave. The advantage of the dual mode is that the samples are synchronised, for example, they could be the signals before and after an amplifier. A disadvantage is that the sampling rate is almost halved.

Compare, "c"; Normal, "n"; Clear, "clear"



Figure 14. Compare mode.

If synchronisation of two waveforms is not important, for example, with the obvious out of phase situation in Figure 13 then a multi-channel mode may be obtained through a single channel. Sample the first signal in the normal manner and once a satisfactory display is obtained then enter 'c' (compare) which will prevent the screen from being cleared. Now take another sample and when this is displayed it will go on top of the first one, as shown in Figure 14. In fact other samples may be added but the display becomes messy with more than two unless the samples are level shifted so that they do not superimpose. Entering 'n' (normal) restores the system to the normal sampling procedure. In this normal mode when a new sample is taken the old sample will be written over in memory up to the value entered for post-trigger blocks. One may, however, use the command 'clear' which will clear out the pre-trigger memory plus the last post-trigger memory up to the block value. This procedure is, however, in Basic and consequently very slow so that it may take several minutes to clear out all of the memory. Using the post-trigger block value and, if required, 'clear' allows a large number of different samples to be stored in memory. Try it!

Frequency Measurement, "f"



As with normal frequency meters one will only obtain reliable results from regular waveforms. The input signal goes via the usual input and the scale adjusted to suit — it should be above +1.1 volts DC or 2.2 volts p-p for AC signals. The 'f test' switch is set to on and the 'gate' switch to the positive gate input. After loading the program, or from the sample mode, entering 'f' will result in the screen displaying 'FREQUENCY OF SAMPLE = xxx Hz' and the value is updated every second. The value should be within 1% of its true value within the range 50Hz to 20 kHz — a correction factor is accessible in Basic.

Menu, "m"; Quit "q"



Entering 'm' will take you back to the first page of the menu if you wish to remind yourself of the instructions while a 'q' will cause a break in the program. The latter instruction is the best means of getting back to Basic and one may then list the program, etc. Since the program is easily accessed and printed by the user we are not using valuable space to re-print it here. The user will, however, require a disassembled version of the machine code routines and these (single plot, dual trace and frequency measurement) are supplied with the program cassette. We hope this will encourage users to further enhance the software described above.

The 'Spectrum' connector, Analogue to Digital interface and cased A/D Controller plus cassette of DIGISCOPE 3 program is available from Digisound Limited, (Contact Details) for £66.70, inclusive of P&P and VAT. The kit include all parts noted in the components list plus the PCB's. For details of power supply, utilising other home micros, ready-built units, etc. then write to Digisound Limited at the above address or (Contact Details).

PARTS LIST

Connectors

28-way wire wrap edge connector
20-way ribbon cable (about 15 cms.)
10-way Molex connecting sets 2 off

Interface Board

Resistors, 5%, ¼W carbon film unless stated
R1 4k7
R2,3 8k2 2 off
R4 see text
R5 180k
R6 390R 1% metal film

Capacitors
C1,2,3,6,7 100n polyester 5 off
C4,5 10u axial electrolytic 2 off
C8 33p polystyrene
C9 1u tantalum bead
C10,11 10n polypropylene

Semiconductors
IC1 74LS30
IC2 74LS02
IC3 8255PPI
IC4 DG 211
IC5 TL 082
IC6 ZN 449

Miscellaneous
8 pin DIL socket 1 off
14 pin DIL socket 2 off
16 pin DIL socket 1 off
18 pin DIL socket 1 off
40 pin DIL socket 1 off
Rubber feet and securing bolts 4 off
Track pins approx. 50

A/D Controller

Resistors, 5% ¼W carbon film
R7,26,32,36,38,41 1k0 6 off
R8,13,15,17,19,21,23, 25,27,29,35 1M0 11 off
R9,10 510k 2 off
R11 820k
R12 200k
R14 110k
R16 51k
R18 20k
R20,47 10k 2 off
R22 5k1
R24 2k0
R28 510R
R30 200R
R31 27k
R33 360k
R34 56k
R37,40 3k0 2 off
R39 22k
R42,44,45,46 100k 4 off
R43 47k
R48 240k

Potentiometers
RV1* 100k min. cermet multiturn
RV2* 10k min. cermet multiturn
RV3 10k carbon
RV4 10k lin rotary

Capacitors
C12,13,15 100n polyester 3 off
C14 1u polyester

Semiconductors
IC7 TL 081
IC8 TL 082
IC9,10 CA3140E 2 off
D1,2 1N4001 2 off
D3,4 3V0 zener diodes 2 off
D5 1N4148
D6,7 6V2 zener diodes 2 off

Miscellaneous
J1 0.25 inch mono jack socket
J2,3 3.5mm jack socket 2 off
S1 2p6w rotary switch
S2 2p12w rotary PCB mounting
S3,4,6,7 SPDT min. toggle 4 off
S5 DPDT min. toggle
S8 Min. push to make
8-pin DIL socket 4 off
10-way Molex connector set
10-way ribbon cable (approx. 1 metre)
Case with printed panel


*RV1 and RV2 are supplied with the keyboard controller kit. The filter fitted into the A/D Controller case is also described and supplied separately.


Series - "Digital Signal Processing"

Read the next part in this series:


All parts in this series:

Part 1 (Viewing) | Part 2 | Part 3 | Part 4


More from these topics


Browse by Topic:

Computing

Electronics / Build



Previous Article in this issue

America

Next article in this issue

Book Review


Publisher: Electronics & Music Maker - Music Maker Publications (UK), Future Publishing.

The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Electronics & Music Maker - Jul 1983

Topic:

Computing

Electronics / Build


Series:

Digital Signal Processing

Part 1 (Viewing) | Part 2 | Part 3 | Part 4


Previous article in this issue:

> America

Next article in this issue:

> Book Review


Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for October 2024
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £0.00

All donations and support are gratefully appreciated - thank you.


Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

If you're enjoying the site, please consider supporting me to help build this archive...

...with a one time Donation, or a recurring Donation of just £2 a month. It really helps - thank you!
muzines_logo_02

Small Print

Terms of usePrivacy