![]() |
|
The di_status_read
function reads the status of the input buffer (opened by di_buffer_alloc
) and copies the newest data points collected in the buffer from the previous call of this function to your specified destination.
unsigned di_status_read(dest,num_scans); |
|
int far * dest; |
/* destination for input data buffer */ |
unsigned num_scans; |
/* number of data points to be copied */ |
User-specified destination for the input data collected.
The number of data points to be copied. If there are not enough data points available in the input buffer, di_status_read
will wait until there are enough available.
If num_scans
is set to 0, di_status_read
will return the number of data points available without waiting.
The di_status_read
function returns the number of data points in the buffer which still have not been copied.
none
#include "200sdk.h" |
|
struct di_mode_struct mode = {0}; |
|
struct di_inlist_struct inlist[256] = {0}; |
|
char errstr[255]; |
|
int analog_in[1024]; |
|
main() |
|
{ |
|
list_length = 5; |
|
if(errcode = di_open()){ |
/* open the device for comm */ |
di_strerr(errcode,errstr); |
|
printf("%s",errstr); |
|
} |
|
if((input_buffer = di_buffer_alloc(0,4096) == NULL) |
/* allocate 4096 words for input */ |
printf("Insufficient memory or input buffer already allocated...\n"); |
|
if(errcode = di_inlist(inlist)) |
/* Set up the input list */ |
printf("Input list error...\n"); |
|
if(errcode = di_mode(mode)) |
/* Set mode */ |
printf("Mode error...\n"); |
|
if(errcode = di_start_scan()) |
/* Start scanning */ |
printf("Start scan error...\n"); |
|
while(di_status_read (analog_in, 0) < 100); |
/* Main loop executes until 100 data points are accumulated. */ |
di_status_read (analog_in, 100); |
/* Copy 100 data points to the analog_in buffer. */ |
if(errcode = di_close()){ |
/* close the device */ |
di_strerr(errcode,errstr); |
|
printf("%s",errstr); |
|
} |
|
} |
Copyright © DATAQ Instruments, Inc.