7

C Program Examples

Example 1

This following C program shows you how to implement the example discussed in the beginning of chapter 5 using the API cell forming (cf) functions. The cell forming functions are included with the driver software supplied with the Agilent E4373A documentation package.

#include <stdio.h> #include <mccd.h>

#define SECONDS_PER_MINUTE 60.0f

void setup(CF_HANDLE server);

main()

{

CF_HANDLE server; int err_ret;

char buf[CF_MEAS_LOG_BUFSIZE]; int retcount;

FILE *fp;

CF_READP read_pos;

CF_RUN_STATE presentState;

/* Open the server connection */

if (cfOpen("15.14.248.100", &server, "mypassword")) { printf("Cannot connect to Agilent MCCD\n"); exit(1);

}

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

/* Set the trigger source to LAN */ cfSetTrigSource(server, CF_LAN);

/* Program the charge/discharge sequence */ setup(server);

/* Initiate sequence and check for sequence consistency */ if (err_ret = cfInitiate(server)) {

printf("Initiate error, code %d\n", err_ret); exit(err_ret);

}

/* Wait for runstate CF_INITIATED. */ do {

Sleep(1000);

cfGetRunState(server, &presentState);

105

Page 105
Image 105
Agilent Technologies E4370A, E4371A, E4374A manual Program Examples, 105