![]() |
|
di_sample_rate
determines how fast sampled data is reported (the Sample Rate).
Note: di_sample_rate
cannot be called while scanning. You should not directly call di_burst_rate
when using di_maximum_rate
and di_sample_rate
. You MUST call di_burst_rate
when sampling different channels at different rates. For the DI-245 or DI-2008, di_list_length
must be called before di_sample_rate
. If more than one channel is enabled, the returned rate will not exceed one tenth of the value returned by di_maximum_rate
.
double di_sample_rate(desired_rate, *oversample, *burst_div); |
|
double desired_rate; |
/* desired sample thoughput rate */ |
long *oversample; |
/* oversampling factor */ |
long *burst_div; |
/* burst rate divisor */ |
When desired_rate
is entered, an attempt is made to report data at that rate. The data will actually be reported at the closest achievable rate to the desired sample rate you requested. The actual sample rate is the value returned by di_sample_rate
.
Note: The desired sample rate cannot exceed the value returned by the previous call to di_maximum_rate
.
oversample
is a pointer to a 32-bit integer that receives an oversampling factor that is needed to achieve the returned sample rate. The user is responsible for putting this value minus 1 into the counter
fields of the di_inlist
structure entries for all channels and passing an array of those structures as an argument to di_inlist
before calling di_start_scan
. If di_maximum_rate
is called after di_sample_rate
, the user must call di_sample_rate
again, update the input list counters, and call di_inlist
before starting a scan.
burst_div
is a pointer to a variable in which the function returns the burst rate divisor argument that was passed in di_burst_rate
. A null pointer may be passed if the user does not need to know the burst rate divisor (this is usually the case).
This function returns the actual Sample Rate.
If di_open
has not been called successfully or if the device has been closed, the return value for di_sample_rate
is 0 and none of the arguments for di_sample_rate
are used.
DI-1100, DI-1110, DI-1120, DI-2108, DI-4108, DI-4208, DI-4718B, and DI-4730 arguments and return values for sample rate are per channel values. Both di_list_length
and di_inlist
must be called first. Call di_maximum_rate
first, and di_inlist
again after di_sample_rate
to set the counter values.
int oversample,burst_div,i; |
|
int chan_count = 4; |
|
struct di_inlist_struct inlist[32] = {0}; |
/* average with gain 1 */ |
di_open(1); |
/* for a device on parallel port LPT1 */ |
di_maximum_rate(150000.0); |
/* for a DI-730 */ |
actual_rate = di_sample_rate(1000.0,&oversample,&burst_div); |
|
for (i = 0; i < chan_count; i++) { |
|
inlist[i].chan = i; |
|
inlist[i].couner = oversample - 1; |
|
} |
|
di_list_length(chan_count,0); |
|
di_inlist(inlist); |
Copyright © DATAQ Instruments, Inc.