home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG091.ARK
/
SPECTRUM.DOC
< prev
next >
Wrap
Text File
|
1984-04-29
|
16KB
|
463 lines
SPECTRUM ANALYSIS SOFTWARE
The programs in this package were written by:
Victor DePinto
2627-148th ave. S.E. Apt. 10
Bellevue, Washington 98007
(206) 641-7591
The last revision date was January 27, 1982.
These programs provide the capability to perform the FFT
and inverse FFT and to perform various arithmetical
manipulations on signals as well as to display the results.
The data processed by these programs is contained in disk
files. Data is also output to disk files except when displayed
on CRT or printer. The data is in the form of a sequence of
1024 complex numbers representing 1024 data points in either
the time or frequency domain.
INSTRUCTIONS FOR USE OF THE FFT PROGRAM
This program performs the FFT or inverse FFT on files
containing a sequence of 1024 complex values. The user
specifies the input and output filenames. Filetypes are .DAT.
Enter only the filename, not the filetype. It is necessary
that the file FFT.COM be on the disk.
To operate this program, type "FFT". The program will ask
for source and destination filenames and then will ask for a
number specifying FFT or inverse FFT. The program will then
perform a 1024 point FFT on the source file and write the
result to the destination file.
INSTRUCTIONS FOR USE OF THE UTILITY PROGRAM
This is a general utility program which allows examination
and plotting of file data and performs certain arithmetic
operations on the data, such as summing, multiplication, and
windowing. In the event that other arithmetic manipulations are
required, the user may write FORTRAN programs which operate on
1024 point complex arrays read and written to unformatted disk
files. It is necessary that the files UTIL.COM and ARIT.COM be
on the disk.
To run the utility program, type "UTIL". The program will
respond with a menu. Following is a list of the menu items with
a brief description of each:
-1-
1 WRITE FILE TO CRT
Write real and imaginary parts of all values in file to
CRT. The user first enters the filename then the first
point to be displayed, and types "Q" to quit. Three
points are displayed on each line. Each point consists of
a real and imaginary part. The first number is the index
of the first point displayed.
2 CREATE REAL PULSE FILE
Creates a file containing a real constant in a user-
specified range of points. All other points are zero, and
all imaginary parts are zero.
3 WINDOW FUNCTIONS
This will bring up another menu offering to multiply a
range of points by any one of a number of popular window
functions.
4 ARITHMETIC FUNCTIONS
This brings up a menu offering to add, subtract,
multiply, or divide two files and place the result in a
third file. It will also multply a file by a constant and
find the conjugates or magnitude squared of a file.
5 PRINT FILE ON PRINTER
Prints real and imaginary parts of of a file on the
system list device.
6 RMS VALUE OF REAL PARTS OF A FILE
Computes the root mean square of he real parts of a file
and writes this value to the CRT.
7 MODIFY FILE
This allows the user to enter or modify the data points
on a point by point basis.
8 TRANSLATE
This rotates (shifts) all data points in a file by user-
specified amount. I must apologize for the slowness of
this routine. No doubt a clever programmer could make it
faster.
9 PLOT FUNCTIONS
This brings up a menu offering to make graphic plots of
time or frequency domain files. The exact nature of the
functions depends on the type of plotting device used. A
version is supplied which will make plots on any printer.
Another version will make high resolution plots on the
Houston Instruments DMP2 plotter.
10 RETURN TO OPERATING SYSTEM
Return to CPM.
-2-
THE PLOTTER INTERFACE
The TTY version of UTIL.COM makes character plots on any
standard printer. The DMP2 version plots on the Houston
Instruments DMP2 plotter. The plotter should be wired for .005
inch per step and 9600 baud serial RS-232C interface. Lower
baud rates are permissible, but will slow the pen motion. The
plotter serial port must be interfaced to the CP/M BIOS as the
PUNCH device.
NOTES ON UTILIZATION
Certain types of data to be processed by this software may
be generated by the utility program itself. (ie. pulses, double
pulses, truncated spectra, etc.) Other data will be in files
written by user-generated programs or possibly acquired from
the real world. A lot of things can be done with a little
imagination.
Here are some possibilities: To truncate a spectrum,
multiply by a real pulse. To filter a signal, multiply it's FFT
by the frequency domain filter function. This may be the FFT of
the impulse response of the filter. A double pulse may be
created by summing two single pulses. Signals may be added and
subtracted in either the time or frequency domain. The program
may be used to examine the spectra of waveforms in contemplated
circuit design, to determine design suitability without lab
measurements. The inverse FFT may be used as a tool in the
design of FIR filters.
One version of my software had a provision for uniform
rate data acquisition from an analog to digital converter. This
is not provided in the package because of it's hardware-
dependent nature, but it could easily be implemented by the
user. In order to get the ADC data into a format compatible
with this software, write a Microsoft FORTRAN program which
defines both an integer array and a floating point array. An
assembly language subroutine is linked with the FORTRAN
program. By means of data area declared COMMON, the assembly
language routine routine fills the integer array with 1024
samples from the ADC. The FORTRAN program will then transfer
the data from the integer array to the real parts of the
floating point array and write it to disk. The integer numbers
will automatically be converted to floating point. The data
would then be processed by this software. Thus, with the
addition of an analog to digital converter, the computer
becomes a Fourier Transform spectrum analyzer.
-3-
FILE STRUCTURE
This software processes data in arrays consisting of 1024
complex data points. Each complex data point consists of two
floating point numbers, the real part and the imaginary part.
When in memory, these numbers are stored in the following
sequence: real part of point 0, imaginary part of point 0, real
part of point 1, imaginary part of point 1, and so on. Since
each floating point number occupies four bytes, a complex data
point occupies 8 bytes.
These arrays, or signal vectors, are stored in disk files
in internal machine format (not ASCII). This permits much
faster access and more compact storage. In general a program
will get a 1024 point signal vector to be processed from such
an unformatted disk file, and then write the processed data to
a similar file. Each disk file occupies 8 kilobytes. Disk
filenames are specified by the user. The filetypes are always
DAT.
If the user writes programs generating data to be
processed by this software, it should be stored in memory in a
2 by 1024 array. Element (1,N) is real; element (2,N) is
imaginary. The data should then be written to disk using the
FORTRAN unformatted write statement.
DISK I/O WITH BASIC
Compatible data files can be also be read and written to
disk using Microsoft BASIC. Since the data must be stored in
internal binary form, you must use only random access files. A
file must contain 1024 complex values. A file called
DISKIO.BAS is included in this package, as an example.
COMPILING AND LINKING
In order to produce executable object programs, compile
the FOR files with the Microsoft FORTRAN-80 compiler and
assemble the MAC files with the MACRO-80 assembler. The
resulting REL files must then be linked using the L80 linking
loader. The final developement work on this package was done
with FORTRAN-80 version 3.4.
The objective is to produce three COM files:
UTIL.COM
ARIT.COM
FFT.COM
FFT.COM performs the 1024 point FFT and inverse FFT by means of
a radix-2 Cooley-Tukey algorithm. UTIL.COM is a program which
performs various computation and display functions. ARIT.COM is
-4-
not intended to be run by itself, but is chained by UTIL.COM.
A note of explaination is needed with regard to the
plotting capabilities of this package. It is possible to make
two different versions of UTIL.COM. They are identical except
for their plotting functions. The TTY version will make plots
on any printer. The DMP2 version produces high resolution plots
on the Houston Instruments DMP2 plotter. You will be able to
modify the plotting modules of this software to accomodate
other types of plotting devices. The chart below shows which
source files are needed to produce each COM file.
TASK SOURCE FILE MODULE NAMES IN FILE
-------------------------------------------------------------
(DMP2 version)
UTIL.COM UTIL.FOR UTIL
NAME.FOR READ, NAME
WIND.FOR WIND, RECTAN, COSBEL, HAFSIN
TRIANG, HANNIN, HFSIN3
HAMMIN, COSSQR, PARZEN
QCHEK.MAC QCHEK
PLOT.FOR PLOT
HI.FOR DRAW, HOME, VECTOR
GRID, BORDER, SPEED
HIA.MAC PRINT, STTIM, PENUP
PENDN
(TTY version)
UTIL.COM UTIL.FOR UTIL
NAME.FOR READ, NAME
WIND.FOR WIND
QCHEK.MAC QCHEK
TTYPLOT.FOR PLOT, TTDRAW
ARIT.COM ARIT.FOR ARIT
NAME.FOR READ, NAME
FFT.COM FFT.FOR FFT1K
NAME.FOR NAME
-5-
To facilitate linking of the runtime tasks, four submit
files are provided. Before these submit files are used, the FOR
and MAC files must be compiled and assembled.
To link Type
UTIL.COM (TTY vers.) SUBMIT UTIL#T
UTIL.COM (DMP2 vers.) SUBMIT UTIL#H
ARIT.COM SUBMIT ARIT#
FFT.COM SUBMIT FFT#
THE TWIDDLE PROGRAM
For speed, the FFT program has the needed sine and cosine
values initialized in data memory. These values were generated
by a FORTRAN program which wrote them to disk in ASCII form.
The sines and cosines were then edited into the DATA statement
in the FFT.FOR program. The twiddle factor generator program
is provided in a file named TWIDDLE.FOR for those who wish to
use it to make other FFT programs.
-6-
FILES SUPPLIED
Following is a list of files supplied in this package. Two
versions of the executable utility program are supplied. UTIL-
TTY.COM plots on any standard printer. UTIL-HI.COM plots on the
Houston Instruments DMP2 plotter. Rename the one you want to
use as UTIL.COM.
FILENAME COMMENTS
ARIT.FOR Arithmetic functions.
ARIT.COM Executable arithmetic functions.
ARIT#.SUB Submit file.
DISKIO.BAS Disk file I/O in BASIC.
FFT.FOR 1024 point FFT.
FFT.COM Executable FFT program.
FFT#.SUB Submit file.
HI.FOR DMP2 driver.
HIA.MAC DMP2 driver.
NAME.FOR Filename getter.
PLOT.FOR Plotter plot routine.
QCHEK.MAC Checks for abort command.
SPECTRUM.DOC This documentation.
SPECTRUM.TEX TEX input file.
TTYPLOT.FOR Printer plot routine.
TWIDDLE.FOR Generates twiddle factor table.
UTIL.FOR Utility program.
UTIL#H.SUB Submit file.
UTIL#T.SUB Submit file.
UTIL-HI.COM DMP2 version of UTIL.COM.
UTIL-TTY.COM TTY version of UTIL.COM.
WIND.FOR Window functions.
-7-