Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

DPO7k MATLAB ICT Get FF Waveform 1

Questions in this forum area are community supported. Tektronix does not regularly monitor posts in this area.
Post Reply
Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

DPO7k MATLAB ICT Get FF Waveform 1

Post by Carl M » July 21st, 2010, 4:27 pm

a demonstration of how to setup a fast frame acquisition and read the sample values of each frame.

Code: Select all

%% 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);
please discuss
Tektronix Application Engineer

gumbaroo
Posts: 1
Joined: August 18th, 2010, 1:56 pm

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by gumbaroo » August 18th, 2010, 2:01 pm

Thanks for this help.

However, I am having a strange issue with this m-file. When I run it the first time it fails. I first get:

"Warning : The EOI line was asserted before size values were available."

Then it times out. If I then run it again it works.

If I change anything on the scope. I have to run it again, let it fail, then run it again to get it to work.

Any idea what could be going on? I'm using a DPO7104.

Thanks.

Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by Carl M » September 9th, 2010, 3:38 pm

it's just a warning, you can ignore it.

you are reading more bytes than are available.
Tektronix Application Engineer

menezes
Posts: 1
Joined: November 23rd, 2010, 7:01 pm

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by menezes » November 23rd, 2010, 7:24 pm

Hello Buck,

I tried your code with DPO 7104 and Matlab R2010b and got the following errors:

Warning: VISA: Error - The specified operation or request timed out

ans =

''
Warning: VISA: Error - The specified operation or request timed out
Warning: VISA: Error - The specified operation or request timed out
??? Error using ==> icinterface.fread at 167
SIZE cannot be set to NaN.

Error in ==> DPO7000 at 78
bytes = char(fread(dpo7k, str2double(a))');

Any idea about these erros?

norfu
Posts: 2
Joined: November 24th, 2010, 1:04 am

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by norfu » November 24th, 2010, 1:16 am

Hi there.
Thanks for the Code. I was just wondering, where I can get a good manual for all these commands?

Could you give a link to the programmer manual you are refering to?

Thanks,
Norman

Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by Carl M » November 29th, 2010, 2:22 pm

tek.com, use the download finder and set it to manuals: dpo7000 programmer
Tektronix Application Engineer

Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by Carl M » November 29th, 2010, 2:32 pm

menezes wrote:Warning: VISA: Error - The specified operation or request timed out
i think it timed out. increase the timeout.
Tektronix Application Engineer

norfu
Posts: 2
Joined: November 24th, 2010, 1:04 am

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by norfu » November 30th, 2010, 12:42 am

Buck wrote:tek.com, use the download finder and set it to manuals: dpo7000 programmer
Thanks so far. I've been there but can't find a suitable manual for my TDS5032B. I guess the programming language is the same as for the dpo7000?

Thanks a lot!

Norman

Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: DPO7k MATLAB ICT Get FF Waveform 1

Post by Carl M » November 30th, 2010, 2:54 pm

i think this will work with a tds5000 series. i think they are all the same commands.
Tektronix Application Engineer

Post Reply

Return to “Other or Discontinued Oscilloscopes”

Who is online

Users browsing this forum: No registered users and 2 guests