/* Enter integer returned */
/* returns a 0 when calibration complete */ /* Calibration for this channel aborted */

/*** VOLTAGE OUTPUT ADJUSTMENT

***/

for (i=1;i<num_chan+1;i++)

 

 

{

 

 

result = 0;

 

 

while (result < 1)

 

 

{

 

 

err=viPrintf(dac, “CAL%d:CONF:VOLT?\n”,i);

/* Configure for calibration */

if(err < VI_SUCCESS) err_handler(dac, err);

 

err=viScanf(dac, “%d”, &result);

 

/* Enter integer returned */

/* returns a 1 when ready to calibrate */

if(err < VI_SUCCESS) err_handler(dac, err);

}

result = 1;

while (result !=0)

{

meas_volt=get_voltage ();/* Get the voltage measurement */ err=viPrintf(dac, “CAL%d:VAL:VOLT? %f\n”,i,meas_volt); /* Send the measurement*/ if(err < VI_SUCCESS) err_handler(dac, err);

err=viScanf(dac, “%d”, &result);

if(err < VI_SUCCESS) err_handler(dac, err); if (result == 5)

{

printf (“Calibration for channel %d aborted\n”,i); result = 0;

}

}

}

 

 

/*** CURRENT OUTPUT ADJUSTMENT

***/

/*** set the calibration resistor value

***/

 

result = 0;

 

 

while (result < 1)

 

 

{

 

 

err=viPrintf(dac, “CAL:CONF:RES?\n”);

/* Configure for resistance calibration */

if(err < VI_SUCCESS) err_handler(dac, err);

 

err=viScanf(dac, “%d”, &result);

 

/* Enter integer returned */

if(err < VI_SUCCESS) err_handler(dac, err);

/* returns a 1 when ready to calibrate */

 

}

meas_res = get_resistance();

err=viPrintf(dac, “CAL:VAL:RES %f\n”,meas_res); /* Send the resistance value */ if(err < VI_SUCCESS) err_handler(dac, err);

/*** channel current output adjustment ***/

for (i=1;i<num_chan+1;i++)

{

result = 0;

while (result < 1)

{

err=viPrintf(dac, “CAL%d:CONF:CURR? \n”,i); /* Configure for calibration */ if(err < VI_SUCCESS) err_handler(dac, err);

163 Voltage/Current Output Adjustment

Appendix D