![background image](http://html1.mh-extra.com/html/tektronix/keithley-2200-series/keithley-2200-series_programming-reference-manual_1078449087.webp)
{
ErrorStatus = viPrintf(KI200, "INSTrument:NSELect %d\n", i+1); //Select the channel
CheckError("Unable to select the channel");
ErrorStatus = viPrintf(KI200,"Measure:voltage?\n"); // Measure the output voltage
CheckError("Unable to write the device");
ErrorStatus = viScanf(KI200,"%f",&query[i][0]); // Retrieve the reading
CheckError("Unable to read voltage");
ErrorStatus = viPrintf(KI200,"Measure:current?\n"); // Measure the output current
CheckError("Unable to write the device");
ErrorStatus = viScanf(KI200,"%f",&query[i][1]); // Retrieve the reading
CheckError("Unable to read current");
printf("Channel: %d, measured voltage(V):%f, current(A):%f \n", i+1,
query[i][0], query[i][1]);
}
return 0;
}
void OpenPort()
{
//Open communication session with the power supply
ErrorStatus = viOpenDefaultRM(&defaultRM);
ErrorStatus =viOpen(defaultRM,
"USB0::0X0699::0X0397::083001106673201002::INSTR",0,0,&KI200);
/*When using the GPIB interface, replace the above command line with
"GPIB0::21::INSTR". Note the argument "21" is an example and refers to the GPIB address.
Substitute the appropriate GPIB address in the command line.*/
CheckError("Unable to open the port");
SendSCPI("SYSTem:REMote");
}
void SendSCPI(char* pString)
{
char* pdest;
strcpy(commandString,pString);
strcat(commandString, "\n");
ErrorStatus = viPrintf(KI200, commandString);
CheckError("Can't Write to Power Supply");
pdest = strchr(commandString, '?'); // Search for the query command
if (pdest != NULL)
{
ErrorStatus = viBufRead(KI200, (ViBuf)ReadBuffer,
sizeof(ReadBuffer), VI_NULL);
CheckError("Can't read from driver");
strcpy(pString, ReadBuffer);
}
}
void ClosePort()
{
Series 2200 Programmable Multichannel DC Power Supplies Programmer Manual
B-3
Summary of Contents for KEITHLEY 2200 Series
Page 2: ......
Page 6: ......
Page 11: ...Getting Started...
Page 12: ......
Page 65: ...Status and Events...
Page 66: ......
Page 81: ...Appendices...
Page 82: ......
Page 103: ......