beautypg.com

BNC 1105 Universal Counter User Manual

Page 193

background image

193

193

193

193

/*----------------------------------------------------------------------------------*/

/*----------------------------- Read From Device -------------------------------*/

stat = viWrite(sesn, (unsigned char *)("FETC?"), 5, &ret);

//

stat = viWrite(sesn, "READ?", 5, &ret);

//

stat = viWrite(sesn, "MEAS:FREQ?", 10, &ret);

//

stat = viWrite(sesn, "SENS:DATA?", 10, &ret);

/*----------------------------------------------------------------------------------*/

stat=viRead(sesn,(unsigned char *)readin,128,&ret);

printf ("Read : %s",readin);

stat = viSetAttribute(sesn, VI_ATTR_TMO_VALUE, tmo);

stat = viGpibControlREN(sesn, VI_GPIB_REN_ADDRESS_GTL);

viClose (flist);

viClose (defaultRM);

return 0;

}

Using the Stats to Measurement

Example 7 Stats Modes

// Stats.cpp : Defines the entry point for the console application.

#include "stdafx.h"

#include "visa.h"//include visa32.lib first to the probject.

#define MAX_COUNT 200

#include "stdio.h"

int main(int argc, char* argv[])

{

ViStatus stat; /* For checking errors */

ViSession defaultRM; /* Communication channels */

ViSession sesn; /* Communication channel */

ViChar rsrcName[VI_FIND_BUFLEN]; /* Serial resource name */

ViChar intfDesc[VI_FIND_BUFLEN]; /* Port binding description */

ViUInt32 ret; /* To hold number of resources */

ViFindList flist; /* To hold list of resources */

char readin[128]="";