Series 2200 Programmable DC Power Supplies Reference Manual
Section 4: Command reference
2200S-901-01 Rev. C / March 2016
4-45
SendSCPI("VOLTAGE 0V"); //set the voltage to 0V
SendSCPI("OUTPUT 1"); // turn output on
SendSCPI("TRIGGER:SOURCE BUS"); //set trigger source to bus
/* configure the list*/
SendSCPI("LIST:MODE CONT"); //set the list mode to
continuous
ErrorStatus = viPrintf(PWS4000,"LIST:COUNT
%d\n",List_count); //set the list count
CheckError("Unable to set list count");
ErrorStatus = viPrintf(PWS4000,"LIST:STEP %d\n",List_step);
//set the list step
CheckError("Unable to set list step");
/*set the list voltage, current and time */
for(i = 1; i<= List_step; i+=1)
{
ErrorStatus = viPrintf(PWS4000,"LIST:CURRent %d, %f\n", i,
List_Curr[i-1]); //set the step current
CheckError("Unable to set list current");
ErrorStatus = viPrintf(PWS4000,"LIST:VOLTage %d, %f\n",
i, List_Volt[i-1]); //set the step voltage
CheckError("Unable to set list voltage");
ErrorStatus = viPrintf(PWS4000,"LIST:WIDTH %d, %f\n", i,
List_Time[i-1]); //set the output voltage
CheckError("Unable to set list time");
}
SendSCPI("LIST:SAVE 1"); // save the list
SendSCPI("FUNCTION:MODE LIST"); // set the power supply in
list mode
SendSCPI("TRIGGER"); // trigger the list
printf("List is running\n");
/*Check the state of bit 5 of the Operation Condition
Register to determine if list is still running. */
do
{
delay(500);
ErrorStatus = viPrintf(PWS4000,
"STATus:OPERation:CONDition?\n");
CheckError("Unable to write the device");
ErrorStatus = viScanf(PWS4000,"%d",&OPERreg);
} while (OPERreg & 0x20);
printf("List finished\n");
ClosePort();
while(1); //return 0;
}
void OpenPort()
{
//Open communication session with the power supply
ErrorStatus = viOpenDefaultRM(& defaultRM);
ErrorStatus =viOpen(defaultRM,
"USB0::0X0699::0X0391::006002206573001001::INSTR",0,0,&PWS4000);
CheckError("Unable to open the port");
SendSCPI("SYSTEM:REMOTE");
}
void SendSCPI(char* pString)
{
char* pdest;
strcpy(commandString,pString);