ARB demo 2
This demo shows how to upload a waveform to the function generator.
Download MATLAB file: arb2.zip
Contents
Open function generator and scope
fg = gpib('agilent',7,10); os = gpib('agilent',7,7); set(fg,'OutputBufferSize',16*1024); fopen(fg) fopen(os) fprintf(fg,'*IDN?'); idn = fscanf(fg); fprintf('function generator: %s',idn); fprintf(os,'*IDN?'); idn = fscanf(os); fprintf('oscilloscope: %s',idn); clear idn;
function generator: HEWLETT-PACKARD,33120A,0,8.0-5.0-1.0 oscilloscope: AGILENT TECHNOLOGIES,54622A,US40180412,A.01.01
Set fg output load
fprintf(fg,'Output:Load?'); disp(fscanf(fg)); fprintf(fg,'Output:Load INF');
+9.90000E+37
Read ARB catalog
fprintf(fg,'DATA:CATALOG?');
str = fscanf(fg);
disp(str);
"SINC","NEG_RAMP","EXP_RISE","EXP_FALL","CARDIAC","VOLATILE"
Set function generator to ARB
x = linspace(0,1,500); y = -cos(2*pi*x); idx = find(y<0); y(idx)=0; y=2*y-1; plot(x,y); str = sprintf(',%g',y); fprintf(fg,strcat('DATA VOLATILE',str)); fprintf(fg,'FUNC:USER VOLATILE'); fprintf(fg,'APPLY:USER 500, 2, 0.5'); pause(0.5); fprintf(os,'Autoscale');
Close down
fclose(fg); fclose(os); delete(fg); delete(os); clear