INFO: Dieses Forum nutzt Cookies...
Cookies sind für den Betrieb des Forums unverzichtbar. Mit der Nutzung des Forums erklärst Du dich damit einverstanden, dass wir Cookies verwenden.

Es wird in jedem Fall ein Cookie gesetzt um diesen Hinweis nicht mehr zu erhalten. Desweiteren setzen wir Google Adsense und Google Analytics ein.


Antwort schreiben 

Agilent - Messignal über GPIB auslesen



Wenn dein Problem oder deine Frage geklärt worden ist, markiere den Beitrag als "Lösung",
indem du auf den "Lösung" Button rechts unter dem entsprechenden Beitrag klickst. Vielen Dank!

08.02.2011, 21:23 (Dieser Beitrag wurde zuletzt bearbeitet: 08.02.2011 21:24 von surfman19.)
Beitrag #4

surfman19 Offline
LVF-Neueinsteiger


Beiträge: 7
Registriert seit: Feb 2011

9
-
kA



RE: Agilent - Messignal über GPIB auslesen
Es gibt ja zum Glück schon was fertiges ;D
http://www.mathworks.com/matlabcentral/f...illoscopes

Ich poste folgenden Code mal, könnte sein, das mehrere Leute sowas vor haben...

Source Code in Matlab:
Code:
% Specify data from Channel 1
fprintf(visaObj,':WAVEFORM:SOURCE CHAN1');
% Specify 1000 points at a time by :WAV:DATA?
fprintf(visaObj,':WAVEFORM:POINTS 1000');
% Get the data back as a WORD (i.e., INT16), other options are ASCII and BYTE
fprintf(visaObj,':WAVEFORM:FORMAT WORD');
% Set the byte order on the instrument as well
fprintf(visaObj,':WAVEFORM:BYTEORDER LSBFirst');
% Get the preamble block
preambleBlock = query(visaObj,':WAVEFORM:PREAMBLE?');
% The preamble block contains all of the current WAVEFORM settings.  
% It is returned in the form <preamble_block><NL> where <preamble_block> is:
%    FORMAT        : int16 - 0 = BYTE, 1 = WORD, 2 = ASCII.
%    TYPE          : int16 - 0 = NORMAL, 1 = PEAK DETECT, 2 = AVERAGE
%    POINTS        : int32 - number of data points transferred.
%    COUNT         : int32 - 1 and is always 1.
%    XINCREMENT    : float64 - time difference between data points.
%    XORIGIN       : float64 - always the first data point in memory.
%    XREFERENCE    : int32 - specifies the data point associated with
%                            x-origin.
%    YINCREMENT    : float32 - voltage diff between data points.
%    YORIGIN       : float32 - value is the voltage at center screen.
%    YREFERENCE    : int32 - specifies the data point where y-origin
%                            occurs.

% Now send commmand to read data
fprintf(visaObj,':WAV:DATA?');
% read back the BINBLOCK with the data in specified format and store it in
% the waveform structure
waveform.RawData = binblockread(visaObj,'uint16');

%% Data processing: Post process the data retreived from the scope
% Extract the X, Y data and plot it

% Maximum value storable in a INT16
maxVal = 2^16;

%  split the preambleBlock into individual pieces of info
preambleBlock = regexp(preambleBlock,',','split');

% store all this information into a waveform structure for later use
waveform.Format = str2double(preambleBlock{1});     % This should be 1, since we're specifying INT16 output
waveform.Type = str2double(preambleBlock{2});
waveform.Points = str2double(preambleBlock{3});
waveform.Count = str2double(preambleBlock{4});      % This is always 1
waveform.XIncrement = str2double(preambleBlock{5}); % in seconds
waveform.XOrigin = str2double(preambleBlock{6});    % in seconds
waveform.XReference = str2double(preambleBlock{7});
waveform.YIncrement = str2double(preambleBlock{8}); % V
waveform.YOrigin = str2double(preambleBlock{9});
waveform.YReference = str2double(preambleBlock{10});
waveform.VoltsPerDiv = (maxVal * waveform.YIncrement / 8);      % V
waveform.Offset = ((maxVal/2 - waveform.YReference) * waveform.YIncrement + waveform.YOrigin);         % V
waveform.SecPerDiv = waveform.Points * waveform.XIncrement/10 ; % seconds
waveform.Delay = ((waveform.Points/2 - waveform.XReference) * waveform.XIncrement + waveform.XOrigin); % seconds

% Generate X & Y Data
waveform.XData = (waveform.XIncrement.*(1:length(waveform.RawData))) - waveform.XIncrement;
waveform.YData = (waveform.RawData - waveform.YReference) .* waveform.YIncrement + waveform.YOrigin;

% Plot it
plot(waveform.XData,waveform.YData);
set(gca,'XTick',(min(waveform.XData):waveform.SecPerDiv:max(waveform.XData)))
xlabel('Time (s)');
ylabel('Volts (V)');
title('Oscilloscope Data');
grid on;

Ist es für das Plotten nun egal, ob die Messwerte eine Spannungsverlauf oder einen Stromverlauf darstellen???

lg
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
Antwort schreiben 


Nachrichten in diesem Thema
RE: Agilent - Messignal über GPIB auslesen - surfman19 - 08.02.2011 21:23

Möglicherweise verwandte Themen...
Themen Verfasser Antworten Views Letzter Beitrag
  Messung über GPIB Jenni 10 8.377 28.09.2016 13:22
Letzter Beitrag: Jenni
  Ultraschallmessonde von der Fa. Microsonic über LabView auslesen lassen RoLab 27 19.765 09.04.2014 07:27
Letzter Beitrag: jg
  Messwerte auslesen Agilent 34980a norte 7 8.273 03.09.2011 07:48
Letzter Beitrag: Y-P
  Trigger über GPIB an Keithley 2000 senden surfman19 1 5.078 23.02.2011 14:00
Letzter Beitrag: GerdW
  Messdaten über GPIB MichaelLDW 5 8.829 27.05.2007 23:35
Letzter Beitrag: MudMan

Gehe zu: