Real time data collect and plot with keithley 2636
Show older comments
I am trying to obtain a real time plot of Voltage pulses acquired from a Keithley 2636 Voltage Source. Now, I can only wait until keithley finishes running the script and then acquire data with matlab. I don't know how to collect data while keithley is running (during loop). Below is my script of running program and collecting data.
running program:
vstep=(vMAX-vMIN)/steps;
fprintf(vg, 'vMIN = %f',vMIN);
fprintf(vg, 'vMAX = %f',vMAX);
fprintf(vg, 'vstep = %f',vstep);
fprintf(vg, 'numPoints = %f',steps +1);
fprintf(vg, 'VG = %f',vGate);
xx=max(abs([vMAX vMIN]));
fprintf(vg,'smua.source.rangev= %f', xx);
fprintf(vg,'smub.source.rangev= %f', vGate)
fprintf(vg, 'smua.source.levelv =0');
fprintf(vg, 'smub.source.levelv =0');
fprintf(vg,'loadscript vd_id')
fprintf(vg,'smub.source.output = smub.OUTPUT_ON');
fprintf(vg,'smua.source.output = smua.OUTPUT_ON');
fprintf(vg,'for j=1,2 do');
fprintf(vg,'smub.source.levelv = VG/2*j');
fprintf(vg,'delay(2E-5)')
fprintf(vg, 'end');
fprintf(vg,'smua.measure.autozero = smua.AUTOZERO_AUTO');
fprintf(vg,'smub.measure.autozero = smub.AUTOZERO_AUTO');
fprintf(vg, 'for j=1,2*numPoints-1 do');
fprintf(vg, 'if j<(numPoints)/2 then');
fprintf(vg, 'smua.source.levelv = (vMIN+vMAX)/2 - (j-1)*vstep');
fprintf(vg, 'elseif j>3*(numPoints-1)/2 then');
fprintf(vg, 'smua.source.levelv = (vMIN+vMAX)/2 + (2*numPoints-1-j)*vstep');
fprintf(vg, 'else');
fprintf(vg, 'smua.source.levelv = vMIN + (j-(numPoints-1)/2-1)*vstep');
fprintf(vg, 'end');
fprintf(vg, 'smua.measure.iv(ibuffer,vbuffer)');
fprintf(vg, 'smub.measure.iv(igbuffer,vgbuffer)');
fprintf(vg, 'end');
fprintf(vg,'for j=1,2 do');
fprintf(vg,'smub.source.levelv = VG-VG/2*j');
fprintf(vg,'delay(2E-5)')
fprintf(vg, 'end');
fprintf(vg,'smub.source.output = smub.OUTPUT_OFF');
fprintf(vg,'smua.source.output = smua.OUTPUT_OFF');
fprintf(vg, 'endscript');
collecting data:
fprintf(vg,'*OPC?');
bLoop = 1;
while (bLoop == 1)
status = fscanf(vg, '%d');
if (status == 1)
bLoop = 0;
end
end;
% read I
temp='';
fprintf(vg, 'printbuffer(%d, %d, ibuffer.readings)',[1 2*steps+1])
while (length(temp) == 0)
temp = fscanf(vg, '%s');
end;
temp = regexprep(temp, ',', ' ');
i_list(:,1) = sscanf(temp, '%f');
Accepted Answer
More Answers (0)
Categories
Find more on Downloads in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!