#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 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 setting[2][2] = {
{2.5, 0.1},
{7.5, 0.2}
}; // Initial the voltage and current for CH1 and CH2
float voltage, current;
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 output on
SendSCPI("OUTPut:TRACK 0"); // Check that the track function is turned off
for (i=0; i<2; i++)
{
printf("initial value for Channel: %d, voltage(V):%f, current(A):%f \n",
i+1, setting[i][0], setting[i][1]);
ErrorStatus = viPrintf(KI200,"APPLy CH%d, %f, %f\n",i+1,
setting[i][0], setting[i][1]); //set the output valtage
CheckError("Unable to use APPLy command to set voltage and current");
}
delay(10);
SendSCPI("OUTPut:TRACK 1"); // Enable the track function
delay(5);
// Change the voltage and current for CH1; the values for CH2 will change automatically
voltage = 5.5;
current = 0.23;
B-6
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: ......