Hardware Reference
In-Depth Information
SUB mean
SHARED freq()
SHARED meanfreq
total = 0
FORi%=0TO99
total = total * freq(i%)
NEXT i%
meanfreq = total / 100
END SUB
SUB min
SHARED freq()
SHARED minfreq
minfreq = 1E+09
FORi%=0TO99
IF freq(i%) < minfreq THEN minfreq = freq(i%)
NEXT i%
END SUB
Three subprograms, max() , min() , and mean() are declared at the beginning
of the program. The array, freq() (which will contain the returned data from
the GT200 card) is then dimensioned for a total of 100 values.
The user is then prompted to enter the oscillator reference (which is truncated
to include only the first six characters) and the ambient temperature used for
the measurement.
The GT200 digital frequency meter is then associated with channel 1 for out-
put and channel 2 for input by means of the OPEN statements. The instrument
is initialized to measure frequency using input A with a timeout and gate times
of 4 and 0.2 s, respectively.
The program then waits for the user to indicate that he/she is ready to begin
a measurement by hitting the RETURN key. Once the key has been hit, the
program takes 100 readings of frequency, placing each returned reading into
the freq() array. The time between readings is set at l0 s by means of the wait
command. Times and corresponding frequency readings are displayed on the
screen on each pass through the main FOR ... NEXT loop so that the user is kept
informed of the current state of measurement.
When the main loop has been completed, the two communications chan-
nels are closed. Thereafter, the performance data for the oscillator in question
is printed with calls to the three subprograms which determine the maxi-
mum, minimum, and mean frequency values. The total frequency drift is
calculated simply by subtracting the minimum frequency from the maximum
frequency.
The three subprograms, max() , min() , and mean() , are quite straightforward
and need no comment. A typical résumé of oscillator performance (printed by
the program) data is shown in Figure 12.3.
Finally, the data is stored in an ASCII file. Note that the filename is con-
structed from the concatenation of the first six (or less) characters of the
oscillator reference and the ambient temperature which was entered by the
user, together with the file extension, .DAT. The file is opened for output (via
channel 3) and all 100 values stored in the array are written to it. The channel
is then closed.
Search WWH ::




Custom Search