108 Application Programs
cmd = "VOLT:MODE LIST”; /* Set to get voltage from List */
ibwrt(sloto, cmd, strten(cmd));
if (ibsta & ERR)
error(cmd);
strcpy(vlist, "LIST:VOLT “); /* Start with the command header for the voltage List. */
for (i = 1; i < NUM_PTS; i++) { /* The Loop calculates the string */
sprintf(vpoint, “ %f, “, vstart+(((vstop - vstart) / NUM_PTS) * i)); /* equivalents of the voltage List */
strcat(vlist, vpoint); /* points and concatenates them for */
} /* only the first 19 because there */
/* should not be comma after the */
sprintf(vpoint , “%f” , vstop); /* last point. Do the last point */
strcat(vlist, vpoint); /* separately with no comma. */
ibwrt(slot0, vlist, strlen(vlist)); /* Download voltage List points */
if (ibsta & ERR)
error(vlist);
sprintf(cmd_buff, "LIST:DWELL %f”, dwell); /* Download 1 dwell time. Use number to */
ibwrt(slot0, cmd_buff, strlen(cmd_buff)); /* string conversion to send the real */
if (ibsta & ERR) /* number over the bus as part of the */
error(cmd_buff); /* command string. */
cmd = "LIST:STEP AUTO”; /* Dwelt-paced List */
ibwrt(slot0, cmd, strlen(cmd));
if (ibsta & ERR)
error(cmd);
cmd = "INITIATE"; /* Enable trigger to start List */
ibwrt(slot0, cmd, strlen(cmd));
if (ibsta & ERR)
error(cmd);
/* Before triggering the module, determine if it is ready by checking for
'Waiting for Trigger' (bit 5 of the Operation Status Register).
You could eliminate this step by simply inserting a pause in the program. However, by checking the instrument status, you can avoid
timing problems. Also, any other operations that take time will give the module a chance to complete processing. */
do {
cmd = "STATUS:OPERATION:CONDITION?";
ibwrt(slot0, cmd, strlen(cmd));
if (ibsta & ERR)
error(cmd);
ibrd(slot0, condition_data, SMALL_STRING); /* Allow to read SMALL_STRING bytes, which is more */
if (ibsta & ERR) /* than enough. Note that first byte will be a + sign, */
error(condition_data); /* so you must convert the string to float, then to int, */
/* to do an integer bit test. */
} while (((int)(atof(condition_data)) && WTG) == 0); / * Loop until WTG = bit 5 (value 32) is true. */
/* Send trigger command to start List and generate the voltage ramp. */
cmd = "TRIGGER:IMMEDIATE”; /* This is an immediate trigger, which is always */
ibwrt(slot0, cmd, strlen(cmd)); /* active. Therefore, it does not need to be */
if (ibsta & ERR) /* selected as a trigger source. */
error(cmd);