![background image](http://html1.mh-extra.com/html/tektronix/keithley-2200-series/keithley-2200-series_programming-reference-manual_1078449091.webp)
ErrorStatus = viPrintf(KI200,"APPLy CH1, %f, %f\n", voltage, current); //Set the output voltage
CheckError("Unable to use APPLy command to set voltage and current");
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 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()
{
viClose(KI200);
viClose(defaultRM);
}
void CheckError(char* pMessage)
{
if(ErrorStatus != VI_SUCCESS)
{
printf("\n %s",pMessage);
ClosePort();
exit(0);
}
}
Series 2200 Programmable Multichannel DC Power Supplies Programmer Manual
B-7
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: ......