Functions > di_start_scan

Syntax

The di_start_scan function starts scanning.

Note: While scanning, you should not issue any other functions. If you call other functions while actively scanning, unexpected results may occur. If you wish to use any other functions, you must first stop scanning, call the desired function, then resume scanning.

Syntax

int di_start_scan(void);

Parameters

none

Return Value

DI_NO_ERR No error
DI_OPENED_ERR Device not opened
DI_COMM_ERR Communication error. For synchronized DI-1120, DI-2008, DI-2108P, DI-4108, DI-4208and DI-4718B devices, this error can occur if all devices with channels enabled are not connected through the same USB controller.
DI_START_SCN_ERR Start scan error. For synchronized DI-1120 devices, this means that all devices with channels enabled must all have firmware versions less than 1.10, or all must have firmware versions greater than 1.10. To request a free DI-1120 firmware upgrade program, please submit a support ticket.

Dependencies

di_open

di_inlist or di_outlist

di_list_length

di_mode

di_buffer_alloc

Remarks

On all instruments except the DI-500 Series, scanning will stop if data is sent from the output buffer to the instrument with either of the two least significant data bits set (the two LSB's of data must be zero to start the scanning process).

Sample Code

#include "200sdk.h"

int errcode;

#define IDIM 256;

/* largest value allowed */

struct di_inlist_struct inlist[IDIM] = {0};

/* input list cleared */

struct di_mode_struct mode = {0};

/* mode structure */

char errstr[255];

int * input_buffer;

main()

{

int i;

if(errcode = di_open()){

/* open the device for comm */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Device installed successfully.....\n");

inlist[0].chan = 5;

/* channel 5 */

inlist[0].diff = 0;

/* single ended */

inlist[0].gain = 0;

/* gain of 1 */

inlist[0].unipolar = 0;

/* bipolar */

inlist[0].ave = 0;

/* averaging off */

inlist[0].counter = 100;

/* init counter */

di_list_length (IDIM, 0);

if(errcode = di_inlist(inlist)){

/* initialize the input list */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Input list initialized.....\n");

mode.mode = 3;

/* continuous triggering enabled */

mode.trig_level = 0;

/* trigger on zero crossing */

mode trig_slope = 0;

/* trigger on positive slope */

mode.trig_pre = 0;

/* no pre-trigger samples */

mode.trig_post = 0;

/* no post-trigger samples */

if(errcode = di_mode(mode)){

/* set mode */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Mode set.....\n");

input_buffer = di_buffer_alloc (0, 40%);

if (input_buffer = = NULL)

printf("Failed to allocate buffer");

if(errcode = di_start_scan()){

/* start scanning */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Scanning started.....\n");

di_close();

}

 

Copyright © DATAQ Instruments, Inc.