Acquiring data from scope RTC 1002 to MATLAB

30 views (last 30 days)
Hi, I´m trying to connect the scope RTC 1002 (Rohde & Schwarz) to MATLAB using the TCPCLIENT connecntion. The connection looks fine but when I try to use the command writeread(), MATLAB throws the following error:
Error reading String.
Timeout occurred waiting for the String Terminator.
According to the RTC 1002 manual, the terminator for TCP connection is LF. However, even it is set into the code, I´m still no able to run the following code and get the data from scope channel 1.
CODE:
disp( ' ' );
disp( '=== CONNECTING TO THE SCOPE ===' );
disp( ' ' );
% try to open
try
% The object creation function tcpclient both creates and connects the object.
scopeObject = tcpclient ('147.83.49.54',5025);
scopeObject.ByteOrder = "big-endian";
scopeObject.Timeout = 20;
catch err
disp (['*** Matlab error message : ' err.message]);
return;
end
configureTerminator(scopeObject,"LF");
terminator = scopeObject.Terminator;
instrumentInfo = writeread(scopeObject, "*IDN?");
disp("Instrument identification information: " + instrumentInfo);
measureComplete = writeread(scopeObject,"*OPC?");
writeread(scopeObject,"AUT");
writeread(scopeObject,"ACQ:MODE RTI");
scopeSource = writeread(scopeObject,"CHAN1:DATA?");
Thank you for helping me

Answers (1)

Gayathri
Gayathri on 19 Nov 2024 at 9:46
I understand that you are facing the error “Timeout occurred waiting for the String Terminator.” while acquiring data from scope RTC 1002 to MATLAB.
What you see in the error message is the TCP/IP client saying that it expected a reply, but it did not receive a reply within the timeout period, or it did not receive the reply that it expected. You can try increasing the timeout value, which allows more time for the response.
This can also happen the terminator is not configured correctly. Even though you have identified the terminator to be “LF”, please try using other terminator options as well to check if data could be acquired in any one of the cases.
Please refer to the following link to a question which talks about the same error.
For more information on “configureTerminator” function, please refer to the following documentation link.
Hope you find this information helpful.
  1 Comment
Nathalia Alves Rocha Batista
Nathalia Alves Rocha Batista on 20 Nov 2024 at 12:14
Hi,
Thank you for your inputs.
The terminator for this specific device is LF. Even if I increase the timeout, it was not working. But, I was able to solve the problem by adding pause(1) between writeread() command. This delay allowed enough time to write/read the data from the server.
Thanks

Sign in to comment.

Categories

Find more on Interface-Based Instrument Communication 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!