
#include "stdafx.h"
#include <visa.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <conio.h>
#include <stdlib.h>
ViSession defaultRM; // Resource manager ID
ViSession KI200; // Identifies the power supply
long ErrorStatus;
char commandString[256];
char ReadBuffer[256];
void OpenPort();
void SendSCPI(char* pString);
void CheckError(char* pMessage);
void delay(clock_t wait);
void ClosePort();
int main(int argc, _TCHAR* argv[])
{
char Buffer[256];
float trig_setting[3][2]={
{11.9, 0.55},
{16.15, 0.25},
{2.5, 0.15}
}; // Voltage, current for trigger
unsigned int i;
OpenPort();
// Query the power supply ID, read the response and print it
sprintf(Buffer, "*IDN?");
SendSCPI(Buffer);
printf("Instrument identification string:%s \n", Buffer);
SendSCPI("*RST"); // Reset the power supply
SendSCPI("OUTPut 1"); // Turn the output on
for (i=0; i<3; i++)
{
printf("setting Channel: %d, voltage(V):%f, current(A):%f \n", i+1,
trig_setting[i][0], trig_setting[i][1]);
ErrorStatus = viPrintf(KI200, "INSTrument:NSELect %d\n", i+1); // Select the channel
CheckError("Unable to select the channel");
// Set the output valtage
ErrorStatus = viPrintf(KI200,"VOLTage:TRIGgered %f\n",trig_setting[i][0]);
CheckError("Unable to set voltage");
// Set the output current
ErrorStatus = viPrintf(KI200, "CURRent:TRIGgered %f\n",trig_setting[i][1]);
CheckError("Unable to set current");
}
// Select the channels that will respond the trigger command
SendSCPI("INSTrument:COUPle ALL");
B-10
Series 2200 Programmable Multichannel DC Power Supplies Programmer Manual
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: ......