
adc100_set_interval
PREF1 unsigned long PREF2 adc100_set_interval (
unsigned long us_for_block,
unsigned long ideal_no_of_samples,
short mode);
This routine specifies the time interval per sample and the channels to be used for calls to
adc100_get_values
or
adc100_get_times_and_values
.
us_for_block
target total time in which to collect
ideal_no_of samples,
in micro seconds.
ideal_no_of_samples
specifies the number of samples that you intend to collect. This number is only
used for timing calculations: you can actually collect a different number of
samples when you call
adc100_get_values
.
mode
This is one of the following:
0 - channel A only
1 - channel B only
2 - both channels
no_of_channels
specifies the number of channels used.
An example of a call to this routine using both channels A and B is:
adc100_set_interval (10000, 100, 2);
The routine returns the actual time to collect this number of samples. This actual time may be greater than the
target time if you specified a sampling interval that is faster than your computer can manage. If the specified
sampling rate was too fast, you have the following choices:
if the total time is important, collect fewer than the ideal number of samples so that the total block time
is correct
if the number of samples is important, collect the same number of samples then allow for the fact that
they took longer to collect.
adc100_get_values
PREF 1 unsigned long PREF2 adc100_get_values
(
unsigned short HUGE * buffer_a,
unsigned short HUGE * buffer_b,
unsigned long no_of_values);
This routine reads in a block of values. It collects readings at intervals and from channels specified in the most
recent
adc100_set_interval
call.
If a key is pressed while collecting, the routine will return immediately. The return value will be zero if a key was
pressed, and the total time in micro-seconds if a block was successfully collected.
When collecting data from just one channel, the parameter for the other buffer can either be set to NULL, or
pointed at the same buffer.