Agilent Technologies E4375A Video Gaming Accessories User Manual


 
7 - C Program Examples
108
/***********************************************************************
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);