Text preview for : Kei2303.488.txt part of Keithley Kei2303.488 Keithley 2304a calsw Kei2303.488.txt



Back to : Kei2303.488.txt | Home

Program CalKeithley2303;
{ Model 2303 calibration program for use with manual calibration}
{4/8/2015 v1.0 by GPS}

const K2303 = 15; //DUT address
K2001 = 16;
fourohm = 3.84735; //Use characterized 4 ohm value.
threek = 3000; //Use characterized 3 k ohm value.
waitforseconds = 180;

var ch:char;
dateofcal:string;
answer:string;
dummy:string;
value:double;

calerr:boolean;
label progend,retry;

procedure waitforkeypress;
begin;
EZGPIB_ScreenWriteln('Press a key to continue.');
repeat
until EZGPIB_KbdKeyPressed;
ch:=EZGPIB_KbdReadKey;
if ch = (CHR(27)) then
begin;
EZGPIB_ScreenClear;
EZGPIB_BusWriteData(K2303,'*CLS');
EZGPIB_ScreenWriteln('Calibration aborted!');
calerr:=true;
repeat
until EZGPIB_KbdKeyPressed;
ch:=EZGPIB_KbdReadKey;
exit;
end;
end;

procedure calend;

begin;

repeat
EZGPIB_TimeSleep(2);
// until EZGPIB_BusSourceOfSrq=K2303;
until EZGPIB_BusSrq;
// EZGPIB_BusWaitForData(K2303,dummy,0.1);
EZGPIB_BusWriteData(K2303,'*ESR?');
EZGPIB_BusWaitForData(K2303,dummy,5.0);

end;

procedure errcheck;
begin;

EZGPIB_BusWriteData(K2303,':SYST:ERR?');
EZGPIB_BusWaitForData(K2303,answer,5.0);
if answer <> '0,"No error"' then
begin
EZGPIB_ScreenWriteln('Error: '+answer);
EZGPIB_ScreenWriteln('Calibration aborted!');
calerr:=true;
end;
end;

procedure readdmm;
begin;
EZGPIB_TimeSleep(5);
EZGPIB_BusWriteData(K2001,':READ?');
EZGPIB_BusWaitForData(K2001,answer,5.0);
answer:=EZGPIB_ConvertToFixed(answer,5);
end;

begin;
calerr:=false;
EZGPIB_ScreenWriteln('Wait for program setup...');
EZGPIB_BusFindAllDevices; // GPIB Bus check.
retry:
EZGPIB_ScreenClear;
EZGPIB_BusWriteData(K2303,'*CLS'); // Initialize 2303.
EZGPIB_BusWriteData(K2303,'*ESE 1;*SRE 32'); // Enable OPC and SRQ.
EZGPIB_BusWriteData(K2001,':SYST:PRES'); // Initialize 2001
EZGPIB_BusWriteData(K2001,':FORM:ELEM READ'); // Reading only.
EZGPIB_ScreenWriteln('Model 2303 Calibration Program');

EZGPIB_ScreenWriteln('Enter calibration date (yyyy,mm,dd)');
dateofcal := EZGPIB_kbdReadln;
dateofcal := EZGPIB_ConvertToDecimalComma(dateofcal)
EZGPIB_ScreenWriteln('');
EZGPIB_ScreenWriteln('');
EZGPIB_ScreenWriteln(dateofcal+' Is it correct? y/n');
answer := EZGPIB_kbdReadln;
EZGPIB_ScreenWrite(' ');
if answer <> 'y' then // .
begin
EZGPIB_ScreenClear;
goto retry;
end;

EZGPIB_BusWriteData(K2303,':CAL:PROT:CODE "KI002303"'); // Send KI002303 cal code.
EZGPIB_BusWriteData(K2303,':CAL:PROT:INIT'); // Initiate calibration.
errcheck;
if calerr then goto progend; // Check for cal error.

EZGPIB_ScreenWriteln('Connect DMM volts input to SOURCE, SENSE, and DVM IN terminals.');
waitforkeypress;
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP0 14;*OPC'); // Output full-scale voltage (14V).
errcheck;
if calerr then goto progend; // Check for cal error.
readdmm;
dummy:=EZGPIB_ConvertToFixed(answer,4);
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP1 '+dummy+';*OPC'); // Calibrate output voltage using external DMM reading.
errcheck;
if calerr then goto progend; // Check for cal error.

readdmm;
dummy:=EZGPIB_ConvertToFixed(answer,4);
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP2 '+dummy+';*OPC'); // Calibrate voltage measuring using external DMM reading.
errcheck;
if calerr then goto progend; // Check for cal error.

EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP3;*OPC'); // Perform DVM input full-scale (14V) cal.
errcheck;
if calerr then goto progend; // Check for cal error.

EZGPIB_ScreenWriteln('Connect DMM volts input and 4 ohm resistor to SOURCE and SENSE.');
waitforkeypress;
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP4 1.9;*OPC'); // Output current (1.9A) 5A full-scale cal.
errcheck;
if calerr then goto progend; // Check for cal error.
readdmm;
value:=(EZGPIB_ConvertToFloatNumber(answer)/fourohm);
dummy:=EZGPIB_ConvertToFixed(value,5);
EZGPIB_ScreenWriteln(dummy);
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP5 '+dummy+';*OPC'); // Calibrate output current limit using calculated current.
errcheck;
if calerr then goto progend; // Check for cal error.
readdmm;
value:=(EZGPIB_ConvertToFloatNumber(answer)/fourohm);
dummy:=EZGPIB_ConvertToFixed(value,5);
EZGPIB_ScreenWriteln(dummy);
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP6 '+dummy+';*OPC'); // Calibrate 5A measurement range using calculated current.
errcheck;
if calerr then goto progend; // Check for cal error.

EZGPIB_ScreenWriteln('Connect DMM volts input and 3 Kohm resistor to SOURCE and SENSE.');
waitforkeypress;
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP7;*OPC'); // Output 5mA nominal current 5mA range full-scale cal.
errcheck;
if calerr then goto progend; // Check for cal error.
readdmm;
value:=(EZGPIB_ConvertToFloatNumber(answer)/threek);
dummy:=EZGPIB_ConvertToFixed(value,5);
EZGPIB_BusWriteData(K2303,'CAL:PROT:STEP8 '+dummy+';*OPC'); // Calibrate 5mA measurement range.
errcheck;
if calerr then goto progend; // Check for cal error.

EZGPIB_BusWriteData(K2303,':CAL:PROT:DATE '+dateofcal); //Save Cal date.
errcheck; // Check for cal error.
if calerr then goto progend; // Check for cal error.
EZGPIB_BusWriteData(K2303,':CAL:PROT:SAVE');
errcheck; // Check for cal error.
if calerr then goto progend; // Check for cal error.
EZGPIB_BusWriteData(K2303,':CAL:PROT:LOCK');
errcheck; // Check for cal error.
if calerr then goto progend; // Check for cal error.
EZGPIB_ScreenWriteln('Calibration completed!.');
progend:
EZGPIB_BusGotoLocal(K2303);
EZGPIB_BusGotoLocal(K2001);

end.