Agilent Technologies E4370A, E4371A, E4374A manual C Program Examples, Main function

Models: E4374A E4371A E4370A

1 141
Download 141 pages 7.46 Kb
Page 108
Image 108

7 - C Program Examples

/*********************************************************************** Main function

***********************************************************************/

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

{

char *szServerAddr = DEFAULT_SERVER; char *szPassword = DEFAULT_PASSWORD; CF_HANDLE hServer;

int nResult;

int nDigitalPort;

char szBarCodeMsg[MAX_BARCODE]; int nBarCodeCount;

int nRunState;

CF_READP readPos; FILE *hFile;

char szMeasBuffer[MEAS_BUF_SIZE]; int nMeasBufCount;

float fCellResistance[CF_MAX_CELLS];

/* Open a connection to an MCCD. */

nResult = cfOpen(szServerAddr, &hServer, szPassword); if (nResult != CF_OK)

{

printf("Could not connect to MCCD: %s\n", szServerAddr); APIError(hServer, "cfOpen", nResult);

}

printf("Connected to MCCD: %s\n", szServerAddr);

/*

*Setup the client API DLL.

*/

/* Install a central error handler function. */ cfSetErrorFunction(APIError);

/* Set the client timeout period. */ cfSetTimeout(CLIENT_TIMEOUT);

/*

*Setup the MCCD server.

*/

/* Reset the server to power-on defaults. */ cfReset(hServer);

/* Set voltage sense to remote. */ cfSetSense(hServer, CF_SENSE_REMOTE);

/* Set trigger source to LAN. */ cfSetTrigSource(hServer, CF_LAN);

/* Set measurement log intervals for all sequence steps. */ cfSetMeasLogInterval(hServer, CF_ALL_STEPS, 0.1f, 0.1f, CF_INFINITY);

/* Set serial port A configuration to use with bar code reader. */ cfSetSerialConfig(hServer, CF_PORTA, 9600,

CF_PARITY_NONE, 8, CF_FLOW_NONE);

/* Enable probe tip checking. */ cfSetSenseProbeTest(hServer, CF_ON);

108

Page 108
Image 108
Agilent Technologies E4370A, E4371A, E4374A manual C Program Examples, Main function