controlling EGS3000B signal generator with VISA

1 次查看(过去 30 天)
Hello i am trying to control my ESG signal generator with gpib VISA code a simple code to change the frequency was made, but it fives me an "fopen" error,what went wrong?
Thanks
freq_cmd = strcat(':FREQ',{' '},'10');
freq_str = freq_cmd{1};
vg = visa('ni','GPIB0::7::INSTR');
if strcmp(get(vg,'status'),'closed')
fopen(vg);
end
fprintf(vg,'10');
fprintf(vg,power_str);
  1 个评论
Scott
Scott 2022-6-8
I realize this question is almost 5 years old, however, I don't think it would hurt to answer.
I think the problem that you were having has to do with the way you are addressing the device. I would check to make sure you have the National Instruments drivers installed (you state 'ni' on the visa object open). If you have some other VISA drivers installed, you may need to call those instead. You can directly try another driver:
vg = visa('rs', 'GPIB0::7::INSTR'); % if using rhode specific driver
vg = visa('keysight', 'GPIB0::7::INSTR'); % if using keysight driver
My guess is that is your primary issue.
From the frequency command standpoint; if we assume the command you are trying to send is ':freq 10', this needs to be done a the same time (in a single command). You're using overly complicated processes for building your command. I'd suggest something like
cmd = [ ':freq ' str2double(some_freq) ];
fprintf(vg, cmd);
Also, you may want to confirm from the programming manual that you do not need to specify Hz/MHz/etc. If you do, you can do something like
cmd = [ ':freq ' str2double(some_freq) ' MHz' ];
fprintf(vg, cmd);

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Instrument Control Toolbox Supported Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by