Instrument control toolbox, problem communicating with instrument

7 views (last 30 days)
I am able to communicate with my instrument (Signal Recovery 7270 DSP Lock-in Amplifier) only 1 out of 2 times. The signal send from fprintf always get to the instrument, but I can read from it only 1 out of 2 time. I am sure the command send to the instrument is right. I am sure that the command get to the instrument because it has a communication monitor where I can read the commands that have been send to it and the answer it will send.
Here is my code:
vu = visa('NI', 'USB0::0x0A2D::0x001B::11117372::0::RAW');
>> fopen(vu)
>> fprintf(vu,'ID')
>> fscanf(vu)
Warning: Unsuccessful read: VISA: Unknown status value 0xBFFF0015
ans =
''
>> fprintf(vu,'ID')
>> fscanf(vu)
ans =
7270
>> fprintf(vu,'VER')
>> fscanf(vu)
Warning: Unsuccessful read: VISA: Unknown status value 0xBFFF0015
ans =
''
>> fprintf(vu,'VER')
>> fscanf(vu)
ans =
2.00
>> fclose(vu)

Accepted Answer

Camil
Camil on 30 Sep 2011
The fprintf and fscanf were not send correctly.
I have to use:
fprintf(vu,'%s', 'MAG'); %Reads Magnitude in volts
fscanf(vu, '%c\n');
And that way it works!
Hope it can help someone one day.

More Answers (1)

Walter Roberson
Walter Roberson on 28 Sep 2011
Looks like that is a timeout. See http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/NI-VISA-status-code-not-decoded-on-Linux/td-p/1035064, which recommends updating your drivers.
  1 Comment
Camil
Camil on 28 Sep 2011
pretty sure, everything is up to date, every thing have been installed today.
If it is a driver issue it would probably not work on the second attempt neither.
By the way, I use Matlab 2011b, windows 7 x64.

Sign in to comment.

Categories

Find more on Downloads in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!