File name Kei2303.488.txtProgram 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 calibratio |