I'm failing to get more than the initial scan reading when trying to download data from the DMM buffer through the KUSB-488B interface. I don't generate any error messages, but I only get the initial reading in the data buffer repeatedly written to my file "dmm_reading.txt".
I'm a novice to SCPI and suspect that the "read" command may not be the best one to use for a buffer dump. Please help me with some sample code that works! Thanks,
Tom (Univ. of Vermont)
- Code: Select all
% Find a GPIB object.
obj1 = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 16, 'Tag', '');
% Create the GPIB object if it does not exist
% otherwise use the object that was found.
if isempty(obj1)
obj1 = gpib('Keithley', 0, 16);
else
fclose(obj1);
obj1 = obj1(1)
end
%define file to write data to.
fid=fopen('dmm_reading.txt','w');
%define configuration variables
Numdata=10;
NumChan=2;
Maxdata=Numdata*NumChan
element=zeros(1,Maxdata)
% Configure instrument object, obj1
fopen(obj1);
set(obj1, 'EOSMode', 'read&write');
get(obj1,'Status')
fclose(obj1);
%remotely configure the instrument settings
%read data from DMM (recall) data buffer
fopen(obj1);
count=0
for i=1:Numdata;
for j=1:NumChan;
count=count+1;
count
fprintf(obj1,'form:elem: read');
fprintf(obj1,'read?');
reading=fscanf(obj1)
%reading=element(1,count);
fwrite(fid, reading);
end
end
% Disconnect from instrument object, obj1.
fclose(obj1);
% Clean up all objects.
delete(obj1);
%clear the data from the workspace'
clear all;

