Brief: Class for buffered multichannel ADC and two channel
counting by NI PCI-6052E board.
This allows you to digitize voltages on up to 16 input channels
and to count pulse streams on two 24 bit counters. The analog
input will be the signals from the integrating segmented silicon
detector. The first counter will count an internal signal as pixel
clock reference, telling us the actual time duration of one pixel.
The second counter will count the signal rate detected by the
proportional
counter detector.
Public member functions:
- C++ constructor
ni_mf()
- C++ destructor
ni_mf()
- This routine should be called before anything else is done.
It establishes contact with the NI PCI-6052E board
int
init_device(log_err *p_log_err)
- This routine needs to be called before any ADconversions are
done. It configures the analog input to our needs and stores some
of parameters used in the structure ai_settings for
later use.
int ai_configure_adc(struct ai_settings
*p_ai_settings,
log_err *p_log_err)
- This routine starts the scan through the ADC channels given in
psChannelVector and stores the results from the ADC in
psBuffer. It also stores some of parameters used in the
structure ai_settings for later use.
int
ai_start_scan(I16 *psBuffer,U32 ulNumSamples,
I16
*psChannelVector,I16 sNumChannels,
struct ai_settings
*p_ai_settings,log_err *p_log_err)
- This routine starts a continous scan of the channels given in
psChannelVector The Volt values are displayed on the
screen and refreshed with fRefreshRate in Hz. Be careful
though to supply the correct dScanRate that you supply as
external scan clock, because the true refresh rate will be
fRefreshRate*(true scan rate)/dScanRate
int
ai_start_contin_scan(I16 *psChannelVector,I16 sNumChannels,
F64 dScanRate,F32 fRefreshRate,log_err *p_log_err)
- This routine checks if a scan is done. It returns 0 if the
scan is complete, 1 if not and -1 if there was an error. One can
compare the value in pulRetrieved with the number of
samples expected.
int ai_buffer_input_status(U32
*pulRetrieved,log_err *p_log_err)
- This routine lets you reset the configuration of the ADC
int ai_unconfigure_adc(log_err *p_log_err)
- This routine converts the digital data in psBuffer
back to volts with double precision and stores it in
pdVoltsBuffer. The conversion is done by a function from
the NIDAQ library.
int ai_convert_to_volts(I16
*psBuffer,F64 *pdVoltsBuffer,
U32 ulNumSamples,I16
sNumChannels,
struct ai_settings *p_ai_settings,log_err
*p_log_err)
- This routine converts the digital data in psBuffer
back to volts with double precision and stores it in
pdVoltsBuffer. The conversion is done with a custom made
formula.
void ai_convert_to_volts(I16 *psBuffer,F64
*pdVoltsBuffer,
U32 ulNumSamples,struct ai_settings
*p_ai_settings,
log_err *p_log_err)
- This routine lets you configure the counter for the pixel
clock. It counts an internally supplied pulse stream. Choose its
frequency by specifying CT_INT_TIMEBASE as
CT_100KHZ or CT_20MHZ.
int
ct_configure_internal_counter(CT_INT_TIMEBASE iTimeBase,
log_err *p_log_err)
- This routine lets you configure the external counter that we
use to determine the signal from the proportional counter
detector
int ct_configure_external_counter(log_err
*p_log_err)
- This routine starts the internal counter(as pixel clock for
sidet scans) The instantaneous 24 bit counter values are stored in
pulBuffer
int ct_start_internal_counter(U32
*pulBuffer,U32 ulNumScans,
log_err *p_log_err)
- This routine starts the external counter (for proportional
counter scans) The instantaneous 24 bit counter values are stored
in pulBuffer
int
ct_start_external_counter(U32 *pulBuffer,U32 ulNumScans,
log_err *p_log_err)
- This routine checks the buffer status of the internal counter.
It returns 0 if the scan is complete, 1 if not and -1 if there was
an error. The number of points done up to the call will be stored
in pulRetrieved
int
ct_internal_buffer_status(U32 *pulRetrieved,log_err
*p_log_err)
- This routine checks the buffer status of the external counter.
It returns 0 if the scan is complete, 1 if not and -1 if there was
an error. The number of points done up to the call will be stored
in pulRetrieved
int
ct_external_buffer_status(U32 *pulRetrieved,log_err
*p_log_err)
- This routine lets you reset both counters
int
ct_reset_counters(log_err *p_log_err)
- This routine normalizes the counter data It takes the
countinuously growing raw data in pulRaw (counters count
continuously) and converts it to be the actual count of each pixel
only. The result is stored in pulNormalized. The 24bit
wrap over is also accounted for.
void
ct_normalize_counts(U32 *pulRaw,U32 *pulNormalized,
U32
ulNumScans)
- int close_device(log_err *p_log_err)
Structure ai_settings:
This structure contains parameters needed to convert the binary
ADC data back to actual voltages. In order to save storage we will
store it along with the data in binary form rather than in double
precision. Its members are:
I16 sVoltRange;
I16 sPolarity;
I16 sGain;
F64 dGainAdjust;
F64 dOffset;
I32 lDigitalRange;
Holger Fleckenstein
2008-07-08