Error using GetWaveform() with Agilent technologies
이전 댓글 표시
Hi,
I am trying to get the waveform data from Agilent DSO-X 2024A Oscilloscope. Below is the code for configuration.
function [myScope]= ConfigureScope( ResourceAddress, AcquiringChannel, TriggeringChannel,TriggerMode, TriggerSlope, TriggerLevel)
% Instantiate an instance of the scope.
myScope = oscilloscope();
myScope.Driver='AgInfiniiVision';
% Find resources.
availableResources = getResources(myScope);
% tektronix mdo3104 %connect to availble resources
myScope.Resource = ResourceAddress;
% Connect to the scope.
connect(myScope);
% Enable channel 1.
enableChannel(myScope, AcquiringChannel);
enableChannel(myScope, TriggeringChannel);
% Set the trigger mode to normal.
set(myScope, 'TriggerMode', TriggerMode);
set(myScope, 'TriggerSlope', TriggerSlope);
set(myScope, 'TriggerSource', TriggeringChannel);
set(myScope, 'TriggerLevel', str2double(TriggerLevel));
%%myScope=ConfigureScope('USB::0x0957::0x1796::MY51250127::INSTR', 'Channel1', 'Channel2', 'normal', 'Falling', '0.1')
Scope is establishing connection with the MATLAB. Problem is when I try to get the waveform, it returns an error (The instrument returned an error while executing the function: Specified channel is not enabled.) and displays "query interrupted" on Oscilloscope screen. However, if I comment last four lines of above mentioned code (i.e. donot set any trigger at all), getwaveform() function works fine. Why is that so? I have to get the signal from channel1 when signal is triggered on channel 2.
Moreover, both channels are enabled.
답변 (1개)
Wilson A N
2018년 2월 3일
The above error is usually thrown when there is no signal source connected to the channel or when the trigger levels that are set is not a valid value(not in the range of the waveform displayed on the scope).
In these conditions, the getWaveform() function times out after 2 seconds and the instrument proceeds to a frozen/bad state. The instrument will continue to wait until the trigger condition is reached and it will not respond to any SCPI command.
In this stage, however, the connection to the oscilloscope from MATLAB is not lost. If the getWaveform() function is executed again, it will still throw the same error. The device will recover only if a signal source is connected to the channels or the set trigger level is in the valid range of the displayed waveform. Manually pressing the run/stop button on the device will also enable it to recover. During the frozen state, the SCPI command '*RST' also will not work as the device won't respond to it.
Hence, to avoid reaching the frozen state, you can check whether the signal source is connected to the channel and the trigger level is in the valid range or not. If the requirement is such that the trigger level reaches the valid range of the displayed waveform only after a certain time, then executing the getWaveform() function inside the while loop and using a try/catch block may help resolve the issue. The code snippet given below illustrates this behaviour.
while true
try
[w1, w2] = getwaveform(o);
disp('success');
break;
catch ME
disp('no success. lets retry');
end
end
The complete script 'scope_waveform.m' which illustrates the above is attached.
It seems that the issue is present only in Agilent Oscilloscope mainly because of how they handle trigger operations.
If possible, please check with Agilent for a firmware update that can help resolve the issue.
카테고리
도움말 센터 및 File Exchange에서 Oscilloscopes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!