%% DPO7k MATLAB ICT Get FF Waveform 1 % Date: 06-23-2010 % ================== % Demonstrate how to retrieve raw sample data from a DPO7k/70k series % oscilloscope fast frame acquisition using the curve query. % % PREREQUISITES % ================== % ALL MATLAB ICT Control 1 % ALL MATLAB ICT Control 2 % ALL MATLAB ICT Control 3 % DPO7k MATLAB ICT Control 4 % DPO7k MATLAB ICT Control 5 % DPO7k MATLAB ICT Control 6 % ================== % % COMPATIBILITY % ================== % DPO7xxx % DPO7xxxx(B) % DSA7xxxx(B) % MSO7xxxx % ================== % % TESTED & DEVELOPED % ================== % Microsoft Windows XP SP3 % TekVISA v3.3.4.6 % MATLAB Version 7.9.0.529 (R2009b) % Instrument Control Toolbox Version 2.9 % Ethernet DHCP % DPO7254 v5.1 % ================== % % Tektronix provides the following example "AS IS" without any guarantees % or support. This example is for instructional guidance only. %% variables visa_brand = 'tek'; visa_address = 'TCPIP::10.0.0.7::INSTR'; buffer = 20 * 1024; %20 KiB frames = 500; record = 5000; %% open instrument dpo7k = visa(visa_brand, visa_address, 'InputBuffer', buffer, ... 'OutputBuffer', buffer); fopen(dpo7k); %% configure fast frame acquisition % see instrument programmer manual for details on instrument commands fwrite(dpo7k, 'acq:state 0'); fwrite(dpo7k, 'head 0'); fwrite(dpo7k, 'acq:mod sam'); fwrite(dpo7k, 'hor:mode man'); fprintf(dpo7k, 'hor:mode:reco %i', record); fwrite(dpo7k, 'hor:fast:state 1'); fprintf(dpo7k, 'hor:fast:coun %i', frames); fwrite(dpo7k, 'wfmo:byt_n 1'); fprintf(dpo7k, ['dat:enc fas;sou ch1;star 1;stop %i;framestar 1;frames' ... 'top %i'], [record frames]); fwrite(dpo7k, 'acq:stopa seq'); fwrite(dpo7k, 'acq:state 1'); % set the timeout long enough for the acquisition to complete dpo7k.Timeout = 60; query(dpo7k, '*opc?') % after acquisition, return the timeout back to default dpo7k.Timeout = 10; %% read sample data fwrite(dpo7k, 'curve?'); % read binary block header fread(dpo7k, 1); %discard '#' character a = char(fread(dpo7k, 1)); bytes = char(fread(dpo7k, str2double(a))'); % init sample matrix samples = zeros(record, frames, 'int8'); % read digital values into sample matrix for k = 1:frames samples(:, k) = fread(dpo7k, record, 'int8'); end fread(dpo7k, 1); %discard linefeed character %% close instrument fclose(dpo7k); % close connection delete(dpo7k); % remove the ICT object clear dpo7k; % remove the local MATLAB variable %% simple plot plot(samples);