1.3.12. - Counting
Another important function of the diffractometer program is to measure the scattered X-ray intensities. spec supports several types of timers, scalers and multichannel analyzers (MCAs). Timers control the count time. Scalers count detected photons. MCAs accumulate many channels of counts and are used with energy-dispersive detectors and positional-sensitive detectors.
To count the number of X rays incident on the detector per second, the counting hardware must be able to accumulate detector counts accurately within a fixed time period. The scaler hardware is gated by a clock that operates independently of the computer. Thus, the response time of the computer to interrupts (real-time events) does not affect the accuracy of the count. spec programs and starts the clock and senses when the clock period, and hence the counting, has ended. spec can then read the contents of the scalers and save the measurement in a data file.
Clearing the scalers and starting the clock is accomplished by the function
tcount(seconds)
. To count for one second, type:
1.FOURC> tcount(1)
2.FOURC>
The contents of the scalers are accessed through the built-in
S[]
array.
The hardware scalers are read and their contents loaded
into the scaler array by the
getcounts
command.
A second, associated string array,
S_NA[]
, is defined in the standard macros and
identifies each scaler:
1.FOURC> getcounts; printf("%s = %g\n%s = %g\n%s = %g\n",\
2.cont> S_NA[0], S[0]/1000, S_NA[1], S[1], S_NA[2], S[2])
seconds = 1 monitor = 347 detector = 35031 3.FOURC>
The first scaler, labeled
seconds
, is usually fed a 1 kHz signal, so it actually tracks milliseconds
and is therefore divided by 1000.
The number of scalers available depends on the particular
hardware and the number of detectors and monitors used.
The default scaler channel numbering for the first three scalers
puts a 1 kHz time signal in scaler 0, monitor counts in scaler 1
and detector counts in scaler 2.
You can also count to a fixed number of monitor pulses, rather than to a fixed time period.
1.FOURC> mcount(1e4)
2.FOURC> getcounts; printf("%s = %.1f\n%s = %g\n%s = %g\n",\
3.cont> S_NA[0], S[0]/1000, S_NA[1], S[1], S_NA[2], S[2])
seconds = 28.8 monitor = 10000 detector = 1.00954e+6 4.FOURC>
Counting is asynchronous, i.e., the
tcount()
and
mcount()
functions return
immediately
after starting the clock.
They do not wait until the counting period is over.
Use the
wait()
function to determine when counting is finished.
A useful macro has been written to count and print the scaler contents:
1.FOURC> ct 5
Thu Aug 20 19:11:51 1987 Seconds = 5 Detector = 175103 (35020.6/s) Monitor = 1730 (346/s) 2.FOURC>
If the argument is omitted, a default count time (stored in the global variable
COUNT
) is used.
A
positive
argument to
ct
signifies
seconds;
a
negative
argument signifies
monitor counts.
1.FOURC> ct -10000
Thu Aug 20 19:13:42 1987 Seconds = 28.3 Detector = 1.0434e6 (36869.3/s) Monitor = 10000 (353.36/s) 2.FOURC>