I have this function to send a command via GPIB connection to a Function generator (Stanford Research Systems, Synthesized Function Generator, model DS345) to change it's amplitude, frequency, and offset. However, when I uncomment the line:
fprintf(obj1, Offs_str)
(which sends the offset value to the function generator), the instrument outputs a 'syntax error'. This is the syntax specified in the manual. Also, if I change the amplitude command to anything other than 0.0 (i.e. change the command to fprintf(obj1, 'AMPL1.1VP'))
, the same syntax error is produced.
It's a long shot, but does anyone have experience using instrument control with a DS345 function generator? Or perhaps there is some issue with the instrumental control syntax?
function [] = FG_on(Offs)
%Convert Offset input to string
Offs_str = strcat('OFFS',num2str(Offs),'VP');
%create GPIB handle
obj1 = instrfind('Type', 'gpib', 'BoardIndex', 1, 'PrimaryAddress',...
19, 'Tag', '');
%Open connection
fopen(obj1);
%Sampling Frequency
fprintf(obj1, 'FSMP1000');
%Amplitude
fprintf(obj1, 'AMPL0.0VP');
%Offset
%fprintf(obj1, Offs_str);
%Modulation Type
fprintf(obj1, 'MTYP5');
%Function Type
fprintf(obj1, 'FUNC5');
end