Functions > di_info

Syntax 

The di_info function loads a structure with information about the device.

Syntax 

int di_info(info);

struct di_info_struct{

unsigned port;

/* device port address */

unsigned buf_in_chn;

/* device input channel */

unsigned buf_out_chn;

/* device output channel (for products that support output) or reserved for compatibility */

unsigned sft_lvl;

/* software interrupt level */

unsigned hrd_lvl;

/* hardware interrupt level */

int huge *buf_in_ptr;

/* input buffer pointer */

unsigned buf_in_size;

/* input buffer size (in words) */

int huge *buf_out_ptr;

/* output buffer pointer (for products that support output) or reserved for compatibility */

unsigned buf_out_size;

/* output buffer size,in words (for products that support output) or reserved for compatibility */

char tsr_version[20];

/* TSR version */

char dsp_version[20];

/* DSP program version */

char sdk_version[20];

/* SDK library version */

unsigned long serial_no;

/* PCB serial no. */

unsigned long last_cal;

/* last calibration time in sec since 1/1/1970 */

char board_id[10];

/* PCB model name */

char pgh_pgl;

/* type of PGA; 0 = PGH, 1 = PGL or reserved for compatibility */

char hrdwr_rev;

/* ASCII char REV letter */

char pal0_rev;

/* ASCII char REV of PAL0 */

char pal1_rev;

/* ASCII char REV of PAL1 */

}*info;

 

Parameters

Elements buf_in_chn and buf_out_chn equal the device's hardware DMA channel or software FIFO number, depending on the instrument. The eighth character of the char dsp_version [20] string is a 14-bit or 16-bit resolution flag. For instruments capable of recording with either 14 or 16 bits of resolution (i.e., DI-720, DI-730, and DI-5001), the eighth character of this string shows “A” for 14-bit and “B” for 16-bit. For all other instruments (i.e., the other instruments that are not capable of recording with either 14- or 16-bits of measurement resolution), “A” means the instrument is using the non-mux DSP program and “B” means the instrument is using the mux version of the DSP program.

Return Value

DI_NO_ERR No error
DI_OPENED_ERR Device not opened
DI_COMM_ERR Communication error
DI_INFO_ERR Information error

Dependencies

di_open

Remarks

The structures returned by di_copy_header32 and di_info32 have padding to align 32-bit structure members declared in HDRDEF32.H on 32-bit boundaries. They should be used with 32-bit Visual Basic or any 32-bit compiler that does not support the recommended -Zp2 switch on the command line.

For DI-1100, DI-1110, DI-1120, DI-2008, DI-2108, DI-2108P, DI-4108,or DI-4208, DI-4718B, if multiple devices are opened, the device for which di_open returns information may be specified by calling di_set_rel_dev(int relindx), where 0 specifies the device with the lowest serial number or the 0-based position of the device in the list of serial numbers passed to di_open. This index may also be set by calling di_digout with bits 14 and 15 both set to select the device used by di_digin, which should only be called for a device that is not scanning. The di_info_struct members buf_in_size returns a truncated value if the size in samples exceeds 0xFFFF. The correct size can be found by calling di_info_32 and looking at the buf_in_size member of di_info_struct_32.

Sample Code

#include "200sdk.h"

int errcode;

struct di_info_struct info;

char errstr[255];

main()

{

if(errcode = di_open()){

/* open the device for comm */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else{

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

if(errcode = di_info(&info)){

/* Get info about the device*/

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else{

printf("\nPort: %04X\n",info.port);

printf("Input chn: %04X\n",info.buf_in_chn);

printf("Output chn: %04X\n",info.buf_out_chn);

printf("Sft lvl: %04X\n",info.sft_lvl);

printf("Hrd lvl: %04X\n",info.hrd_lvl);

printf("Input ptr: %08lX\n",info.buf_in_ptr);

printf("Output ptr: %08lX\n",info.buf_out_ptr);

printf("Input size: %04X\n",info.buf_in_size);

printf("Output size: %04X\n",info.buf_out_size);

printf("TSR Ver: %s\n",info.tsr_version);

printf("DSP Ver: %s\n",info.dsp_version);

printf("SDK Ver: %s\n",info.sdk_version);

printf("Serial #: %08lX\n",info.serial_no);

printf("Last cal: %s",ctime(&info.last_cal));

printf('Board ID: %s\n",info.board_id);

printf("PGH/PGL(1/0): %0x1\n",info.pgh_pgl);

printf("Hard Rev: %c\n",info.hrdwr_rev);

printf("PAL0 Rev: %c\n",info.pal0_rev);

printf("PAL1 Rev: %c\n",info.pal1_rev);

}

di_close();

}

 

Copyright © DATAQ Instruments, Inc.