Appendix B: Programming Examples
void OpenPort(); // void added
void SendSCPI(char* pString);
void CheckError(char* pMessage);
void delay(clock_t wait);
void ClosePort(); // void added
int main(int argc, _TCHAR* argv[])
{
double voltage;
char Buffer[256];
double current;
int OPERreg,i;
float meas_voltage, meas_current;
int List_count=10;
int List_step =3;
double List_Volt[3]= {3.0, 4.0, 6.0};
double List_Curr[3] = {0.1, 0.1, 0.1};
int List_Time[3]= {1,2,3};
}
OpenPort();
//Query the power supply id, read response and print it
sprintf(Buffer, "*IDN?");
SendSCPI(Buffer);
printf("Instrument identification string:%s \n", Buffer);
SendSCPI("*RST"); //reset the power supply
delay(100)
SendSCPI("CURRENT 0.1A"); //set the current to 0.1A
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)
{
B-6
PWS4205, PWS4305, PWS4323, PWS4602, and PWS4721 Power Supply Programmer Manual
Summary of Contents for PWS4205
Page 2: ......
Page 8: ...Preface iv PWS4205 PWS4305 PWS4323 PWS4602 and PWS4721 Power Supply Programmer Manual...
Page 9: ...Getting Started...
Page 10: ......
Page 61: ...Status and Events...
Page 62: ......
Page 75: ...Appendices...
Page 76: ......