60 lines
2.0 KiB
Matlab
60 lines
2.0 KiB
Matlab
% start-up routine for the Prologic USB-GPIB interface
|
|
|
|
NLoop = 10;
|
|
Out = zeros(NLoop,1); % output buffer
|
|
|
|
|
|
dss = instrfind('Port','COM11');
|
|
if (isempty(dss))
|
|
dss = serial('COM11','BaudRate',9600,'DataBits',8,'Parity','none','StopBits',1,'TimeOut',5,'Terminator','CR');
|
|
end
|
|
|
|
fopen(dss); % communication channel for DAC
|
|
fprintf(dss,'++mode 1');
|
|
fprintf(dss,'++auto 0'); % turn off read-after-write for non-querry command
|
|
fprintf(dss,'++eos 1');
|
|
fprintf(dss,'++eoi 1');
|
|
fprintf(dss,'++read_tmo_ms 4000');
|
|
fprintf(dss,'++eot_enable 1');
|
|
fprintf(dss,'++eot_char 13');
|
|
fprintf(dss,'++addr 24'); % GPIB ADDR of the DSM
|
|
fprintf(dss,'*RST');
|
|
%pause(3);
|
|
fprintf(dss,':sour:func:mode curr');
|
|
fprintf(dss,':sour:curr 0');
|
|
fprintf(dss,':sour:del 0');
|
|
fprintf(dss,':sour:curr:mode list'); %
|
|
fprintf(dss,':sour:list:curr 0, 0.0309,0.05878, 0.0809, 0.09511, 0.1, 0.09511, 0.0809, 0.05878, 0.0309');
|
|
fprintf(dss,':sour:list:curr:app 0, -0.0309,-0.05878, -0.0809, -0.09511, -0.1, -0.09511,-0.0809, -0.05878, -0.0309');
|
|
%fprintf(dss,':sour:list:volt 0,0.3090,0.5878,0.8090,0.9511,1.0000,0.9511,0.8090,0.5878,0.3090');
|
|
%fprintf(dss,':sour:list:volt:app 0,-0.3090,-0.5878,-0.8090,-0.9511,-1.0000,-0.9511,-0.8090,-0.5878,-0.3090');
|
|
%fprintf(dss,':sour:volt:trig:sfac 2');
|
|
fprintf(dss,':arm:coun 5');
|
|
fprintf(dss,':trig:coun 20');
|
|
fprintf(dss,':sour:curr:mode list'); %
|
|
fprintf(dss,':outp on');
|
|
fprintf(dss,':init');
|
|
pause(5);
|
|
fprintf(dss,':outp off');
|
|
% fprintf(dss,':sour:swe:rang best');
|
|
% fprintf(dss,':sour:swe:spac lin');
|
|
% fprintf(dss,':sour:volt:star 0.1');
|
|
% fprintf(dss,':sour:volt:stop 1');
|
|
% fprintf(dss,':sour:volt:step 0.1');
|
|
% fprintf(dss,':sens:func "volt"');
|
|
% fprintf(dss,':sens:volt:range:auto on');
|
|
%
|
|
% fprintf(dss,'++rst');
|
|
|
|
% for i = 1:NLoop,
|
|
% fprintf(dss,'read?');
|
|
% fprintf(dss,'++read');
|
|
% Out(i) = fscanf(dss,'%e')
|
|
% end
|
|
%
|
|
% %fprintf(dss,'++auto 0'); % turn on read-after-write for non-querry command
|
|
%
|
|
fprintf(dss,'*RST');
|
|
%
|
|
fclose(dss);
|
|
% delete(dss); |