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 >
Text File  |  1984-04-29  |  16KB  |  463 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                               SPECTRUM ANALYSIS SOFTWARE
  8.  
  9.                  The programs in this package were written by:
  10.  
  11.                     Victor DePinto
  12.                     2627-148th ave. S.E. Apt. 10
  13.                     Bellevue, Washington  98007
  14.                     (206) 641-7591
  15.  
  16.             The last revision date was January 27, 1982.
  17.  
  18.                  These programs provide the capability to perform  the  FFT
  19.             and   inverse   FFT   and   to   perform  various  arithmetical
  20.             manipulations on signals as well as to display the results.
  21.  
  22.                  The data processed by these programs is contained in  disk
  23.             files. Data  is also output to disk files except when displayed
  24.             on CRT or printer.  The data is in the form of  a  sequence  of
  25.             1024  complex  numbers  representing 1024 data points in either
  26.             the time or frequency domain.
  27.  
  28.  
  29.                         INSTRUCTIONS FOR USE OF THE FFT PROGRAM
  30.  
  31.                  This program performs the FFT  or  inverse  FFT  on  files
  32.             containing   a   sequence  of  1024  complex  values. The  user
  33.             specifies the input and output filenames.  Filetypes  are .DAT.
  34.             Enter  only  the  filename,  not the filetype.  It is necessary
  35.             that the file FFT.COM be on the disk.
  36.  
  37.                  To operate this program, type "FFT". The program will  ask
  38.             for  source  and  destination filenames and then will ask for a
  39.             number specifying FFT or inverse FFT.  The  program  will  then
  40.             perform  a  1024  point  FFT  on  the source file and write the
  41.             result to the destination file.
  42.  
  43.  
  44.                       INSTRUCTIONS FOR USE OF THE UTILITY PROGRAM
  45.  
  46.                  This is a general utility program which allows examination
  47.             and  plotting  of  file  data  and  performs certain arithmetic
  48.             operations on the data, such as  summing,  multiplication,  and
  49.             windowing. In the event that other arithmetic manipulations are
  50.             required, the user may write FORTRAN programs which operate  on
  51.             1024  point complex arrays read and written to unformatted disk
  52.             files.  It is necessary that the files UTIL.COM and ARIT.COM be
  53.             on the disk.
  54.  
  55.                  To run the utility program, type "UTIL". The program  will
  56.             respond with a menu. Following is a list of the menu items with
  57.             a brief description of each:
  58.  
  59.  
  60.  
  61.  
  62.                                           -1-
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                1  WRITE FILE TO CRT
  74.                   Write real and imaginary parts of all values in  file  to
  75.                   CRT.  The  user  first enters the filename then the first
  76.                   point to be displayed,  and  types  "Q"  to  quit.  Three
  77.                   points are displayed on each line. Each point consists of
  78.                   a real and imaginary part. The first number is the  index
  79.                   of the first point displayed.
  80.  
  81.                2  CREATE REAL PULSE FILE
  82.                   Creates a file containing a  real  constant  in  a  user-
  83.                   specified range of points. All other points are zero, and
  84.                   all imaginary parts are zero.
  85.  
  86.                3  WINDOW FUNCTIONS
  87.                   This will bring up another menu offering  to  multiply  a
  88.                   range  of points by any one of a number of popular window
  89.                   functions.
  90.  
  91.                4  ARITHMETIC FUNCTIONS
  92.                   This  brings  up  a  menu  offering  to  add,   subtract,
  93.                   multiply,  or  divide two files and place the result in a
  94.                   third file. It will also multply a file by a constant and
  95.                   find the conjugates or magnitude squared of a file.
  96.  
  97.                5  PRINT FILE ON PRINTER
  98.                   Prints real and imaginary parts  of  of  a  file  on  the
  99.                   system list device.
  100.  
  101.                6  RMS VALUE OF REAL PARTS OF A FILE
  102.                   Computes the root mean square of he real parts of a  file
  103.                   and writes this value to the CRT.
  104.  
  105.                7  MODIFY FILE
  106.                   This allows the user to enter or modify the  data  points
  107.                   on a point by point basis.
  108.  
  109.                8  TRANSLATE
  110.                   This rotates (shifts) all data points in a file by  user-
  111.                   specified  amount.  I  must apologize for the slowness of
  112.                   this routine. No doubt a clever programmer could make  it
  113.                   faster.
  114.  
  115.                9  PLOT FUNCTIONS
  116.                   This brings up a menu offering to make graphic  plots  of
  117.                   time  or  frequency domain files. The exact nature of the
  118.                   functions depends on the type of plotting device used.  A
  119.                   version is supplied which will make plots on any printer.
  120.                   Another version will make high resolution  plots  on  the
  121.                   Houston Instruments DMP2 plotter.
  122.  
  123.                10 RETURN TO OPERATING SYSTEM
  124.                   Return to CPM.
  125.  
  126.  
  127.  
  128.                                           -2-
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                  THE PLOTTER INTERFACE
  140.  
  141.                  The TTY version of UTIL.COM makes character plots  on  any
  142.             standard  printer.  The  DMP2  version  plots  on  the  Houston
  143.             Instruments DMP2 plotter. The plotter should be wired  for .005
  144.             inch  per  step  and 9600 baud serial RS-232C interface.  Lower
  145.             baud rates are permissible, but will slow the pen  motion.  The
  146.             plotter  serial port must be interfaced to the CP/M BIOS as the
  147.             PUNCH device.
  148.  
  149.  
  150.                                  NOTES ON UTILIZATION
  151.  
  152.                  Certain types of data to be processed by this software may
  153.             be generated by the utility program itself. (ie. pulses, double
  154.             pulses, truncated spectra, etc.) Other data will  be  in  files
  155.             written  by  user-generated  programs or possibly acquired from
  156.             the real world. A lot of things  can  be  done  with  a  little
  157.             imagination.
  158.  
  159.                  Here are  some  possibilities:  To  truncate  a  spectrum,
  160.             multiply by a real pulse. To filter a signal, multiply it's FFT
  161.             by the frequency domain filter function. This may be the FFT of
  162.             the  impulse  response  of  the  filter. A  double pulse may be
  163.             created by summing two single pulses. Signals may be added  and
  164.             subtracted  in either the time or frequency domain. The program
  165.             may be used to examine the spectra of waveforms in contemplated
  166.             circuit  design,  to  determine  design suitability without lab
  167.             measurements. The inverse FFT may be used  as  a  tool  in  the
  168.             design of FIR filters.
  169.  
  170.                  One version of my software had  a  provision  for  uniform
  171.             rate data acquisition from an analog to digital converter. This
  172.             is not provided  in  the  package  because  of  it's  hardware-
  173.             dependent  nature,  but  it  could easily be implemented by the
  174.             user.  In order to get the ADC data into  a  format  compatible
  175.             with  this  software,  write  a Microsoft FORTRAN program which
  176.             defines both an integer array and a floating  point  array.  An
  177.             assembly   language  subroutine  is  linked  with  the  FORTRAN
  178.             program. By means of data area declared  COMMON,  the  assembly
  179.             language  routine  routine  fills  the  integer array with 1024
  180.             samples from the ADC.  The FORTRAN program will  then  transfer
  181.             the  data  from  the  integer  array  to  the real parts of the
  182.             floating point array and write it to disk. The integer  numbers
  183.             will  automatically  be  converted to floating point.  The data
  184.             would then be  processed  by  this  software.  Thus,  with  the
  185.             addition  of  an  analog  to  digital  converter,  the computer
  186.             becomes a Fourier Transform spectrum analyzer.
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.                                           -3-
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                                     FILE STRUCTURE
  206.  
  207.                  This software processes data in arrays consisting of  1024
  208.             complex  data  points. Each  complex data point consists of two
  209.             floating point numbers, the real part and the  imaginary  part.
  210.             When  in  memory,  these  numbers  are  stored in the following
  211.             sequence: real part of point 0, imaginary part of point 0, real
  212.             part  of  point  1, imaginary part of point 1, and so on. Since
  213.             each floating point number occupies four bytes, a complex  data
  214.             point occupies 8 bytes.
  215.  
  216.                  These arrays, or signal vectors, are stored in disk  files
  217.             in  internal  machine  format  (not  ASCII). This  permits much
  218.             faster access and more compact storage. In  general  a  program
  219.             will  get  a 1024 point signal vector to be processed from such
  220.             an unformatted disk file, and then write the processed data  to
  221.             a  similar  file. Each  disk  file  occupies  8 kilobytes. Disk
  222.             filenames are specified by the user. The filetypes  are  always
  223.             DAT.
  224.  
  225.                  If  the  user  writes  programs  generating  data  to   be
  226.             processed  by this software, it should be stored in memory in a
  227.             2 by 1024 array.  Element  (1,N)  is  real;  element  (2,N)  is
  228.             imaginary. The  data  should  then be written to disk using the
  229.             FORTRAN unformatted write statement.
  230.  
  231.  
  232.                                   DISK I/O WITH BASIC
  233.  
  234.                  Compatible data files can be also be read and  written  to
  235.             disk  using  Microsoft  BASIC. Since the data must be stored in
  236.             internal binary form, you must use only random access files.  A
  237.             file   must   contain   1024  complex  values.  A  file  called
  238.             DISKIO.BAS is included in this package, as an example.
  239.  
  240.  
  241.                                  COMPILING AND LINKING
  242.  
  243.                  In order to produce executable  object  programs,  compile
  244.             the  FOR  files  with  the  Microsoft  FORTRAN-80  compiler and
  245.             assemble  the  MAC  files  with  the  MACRO-80  assembler.  The
  246.             resulting  REL  files must then be linked using the L80 linking
  247.             loader. The final developement work on this  package  was  done
  248.             with FORTRAN-80 version 3.4.
  249.  
  250.                  The objective is to produce three COM files:
  251.  
  252.                         UTIL.COM
  253.                         ARIT.COM
  254.                         FFT.COM
  255.  
  256.             FFT.COM performs the 1024 point FFT and inverse FFT by means of
  257.             a  radix-2  Cooley-Tukey algorithm. UTIL.COM is a program which
  258.             performs various computation and display functions. ARIT.COM is
  259.  
  260.                                           -4-
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.             not intended to be run by itself, but is chained by UTIL.COM.
  272.  
  273.                  A note of  explaination  is  needed  with  regard  to  the
  274.             plotting  capabilities  of this package. It is possible to make
  275.             two different versions of UTIL.COM.  They are identical  except
  276.             for  their  plotting functions. The TTY version will make plots
  277.             on any printer. The DMP2 version produces high resolution plots
  278.             on  the  Houston  Instruments DMP2 plotter. You will be able to
  279.             modify the plotting modules  of  this  software  to  accomodate
  280.             other  types  of  plotting devices. The chart below shows which
  281.             source files are needed to produce each COM file.
  282.  
  283.  
  284.             TASK            SOURCE FILE     MODULE NAMES IN FILE
  285.             -------------------------------------------------------------
  286.             (DMP2 version)
  287.             UTIL.COM        UTIL.FOR        UTIL
  288.                             NAME.FOR        READ, NAME
  289.                             WIND.FOR        WIND, RECTAN, COSBEL, HAFSIN
  290.                                             TRIANG, HANNIN, HFSIN3
  291.                                             HAMMIN, COSSQR, PARZEN
  292.                             QCHEK.MAC       QCHEK
  293.                             PLOT.FOR        PLOT
  294.                             HI.FOR          DRAW, HOME, VECTOR
  295.                                             GRID, BORDER, SPEED
  296.                             HIA.MAC         PRINT, STTIM, PENUP
  297.                                             PENDN
  298.  
  299.  
  300.             (TTY version)
  301.             UTIL.COM        UTIL.FOR        UTIL
  302.                             NAME.FOR        READ, NAME
  303.                             WIND.FOR        WIND
  304.                             QCHEK.MAC       QCHEK
  305.                             TTYPLOT.FOR     PLOT, TTDRAW
  306.  
  307.  
  308.             ARIT.COM        ARIT.FOR        ARIT
  309.                             NAME.FOR        READ, NAME
  310.  
  311.  
  312.             FFT.COM         FFT.FOR         FFT1K
  313.                             NAME.FOR        NAME
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.                                           -5-
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.                  To facilitate linking of the runtime  tasks,  four  submit
  339.             files are provided. Before these submit files are used, the FOR
  340.             and MAC files must be compiled and assembled.
  341.  
  342.                     To link                 Type
  343.  
  344.                     UTIL.COM (TTY vers.)    SUBMIT UTIL#T
  345.                     UTIL.COM (DMP2 vers.)   SUBMIT UTIL#H
  346.                     ARIT.COM                SUBMIT ARIT#
  347.                     FFT.COM                 SUBMIT FFT#
  348.  
  349.  
  350.                                   THE TWIDDLE PROGRAM
  351.  
  352.                  For speed, the FFT program has the needed sine and  cosine
  353.             values  initialized in data memory. These values were generated
  354.             by a FORTRAN program which wrote them to disk  in  ASCII  form.
  355.             The  sines and cosines were then edited into the DATA statement
  356.             in the FFT.FOR program.  The twiddle factor  generator  program
  357.             is  provided  in a file named TWIDDLE.FOR for those who wish to
  358.             use it to make other FFT programs.
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.                                           -6-
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.                                     FILES SUPPLIED
  404.  
  405.                  Following is a list of files supplied in this package. Two
  406.             versions  of the executable utility program are supplied. UTIL-
  407.             TTY.COM plots on any standard printer. UTIL-HI.COM plots on the
  408.             Houston  Instruments  DMP2  plotter. Rename the one you want to
  409.             use as UTIL.COM.
  410.  
  411.             FILENAME        COMMENTS
  412.  
  413.             ARIT.FOR        Arithmetic functions.
  414.             ARIT.COM        Executable arithmetic functions.
  415.             ARIT#.SUB       Submit file.
  416.             DISKIO.BAS      Disk file I/O in BASIC.
  417.             FFT.FOR         1024 point FFT.
  418.             FFT.COM         Executable FFT program.
  419.             FFT#.SUB        Submit file.
  420.             HI.FOR          DMP2 driver.
  421.             HIA.MAC         DMP2 driver.
  422.             NAME.FOR        Filename getter.
  423.             PLOT.FOR        Plotter plot routine.
  424.             QCHEK.MAC       Checks for abort command.
  425.             SPECTRUM.DOC    This documentation.
  426.             SPECTRUM.TEX    TEX input file.
  427.             TTYPLOT.FOR     Printer plot routine.
  428.             TWIDDLE.FOR     Generates twiddle factor table.
  429.             UTIL.FOR        Utility program.
  430.             UTIL#H.SUB      Submit file.
  431.             UTIL#T.SUB      Submit file.
  432.             UTIL-HI.COM     DMP2 version of UTIL.COM.
  433.             UTIL-TTY.COM    TTY version of UTIL.COM.
  434.             WIND.FOR        Window functions.
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.                                           -7-
  459.  
  460.  
  461.  
  462.  
  463.