MATLAB Answers

Test & Measurement tool (tmtool): calling two or more channels in readwaveform

17 views (last 30 days)
I've connected a Tektronix oscilloscope over USB connections (DPO4104 and TDS2012B). I need to export data by the two channels of the TDS 2012B and when I connect the DPO4104 I need to get data for the 4 channels. But I can't do it. I select the readwaveform function but I don´t know how to call all channels.
My question is: How can I call two or more channels in the readwaveform function? I've been trying this:
Input argument(s): 'channel1', 'channel2', 'channel3', 'channel4'.
I hope that you can help me.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Mar 2011
Sorry, no, only a single channel at a time is supported (I read the Tek tds2014 instrument control driver source to check.)

More Answers (2)

Ankit Desai
Ankit Desai on 1 Apr 2011
If you don't mind writing a little MATLAB code, you can open the MATLAB Instrument Driver in midedit tool and add your own, custom readwaveform function that does what you want.
1. midedit('tektronix_tds2014.mdd')
2. Navigate to Waveform>readwaveform
3. Look at the SCPI commands used to read waveform from one channel
4. Add your own function by right clicking "Waveform" node
5. Add the SCPI commands for the function you want
The online documentation on the same might help too.
Here's complete detail on using midedit.
Hope this helps.
  1 Comment
Vicipn on 11 Aug 2011
Thank´s i do exactly that and it´s work, now my problem is control the trigger of the osciloscope I don´t know how to do that. If you can help me I appreciate. See you and Good Look

Sign in to comment.

Helga on 2 Jan 2012
I tried to write a new function for the driver, but it didn't work because it seems that this function
_fprintf(interface,['DATA:SOURCE ' trueSource]);_
doesn't allow two or more channels.
This is the code I wrote for more channels:
_fprintf(interface,['DATA:SOURCE ' trueSource ', ' trueSource2]);_
But when I check with query(interface, 'DATA:SOU?') I only see the first channel.
Has anybody solved this problem already?
  1 Comment
Vicipn on 19 Jan 2012
Hi there sorry for answered till this moment. Look, the main problem with the communication it´s the limitation for the data transport, the first thing that you must chek is the transfer, then the visa address and the visa brand (for example 'tek'). When you solve this, yau can do somthing like this:
dpo = visa(visa_brand,visa_address,'InputBufferSize',buffer,'OutputBufferSize',buffer);
if ans ~= '0'
% Obtención del estado del osciloscopio
head = query(dpo,':head?;');
head = head(end-1);
%verb = query(dpo,':verb?;');
%verb = verb(end-1);
fwrite(dpo,':head 0;*cls;');
[lrn_str bytes warning] = query(dpo,'*lrn?;');
%save dpo4k_spi.lrn lrn_str -ASCII %doesn't work, numerical data
fid = fopen('dpo4k_spi.lrn', 'wt');
Note that it´s important open and close your fid, if you don´t do it, perhaps your program doesn´t work.
now, you can ask the equipment what does have in each channel, using something like this:
% for example channel 1 (ch1)
query(dpo,':data:source ch1;:data?;')
reco1 = query(dpo,':hor:reco1?;'); % find length
fwrite(dpo,[':data:start 1;stop ' reco1(1:end-1) ';']);
% Getting vertical information
% Ch 1
yof1 = query(dpo,':wfmo:yof1?;','%s','%E');
ymu1 = query(dpo,':wfmo:ymu1?;','%s','%E');
yze1 = query(dpo,':wfmo:yze1?;','%s','%E');
% getting horizontal information
% Ch 1
nrp1 = query(dpo,':wfmo:nr_p1?;','%s','%E');
xin1 = query(dpo,':wfmo:xin1?;','%s','%E');
xze1 = query(dpo,':wfmo:xze1?;','%s','%E');
wave1 = int8(binblockread(dpo,'int8'));
scaled_wave1 = (double(wave1)-yof1).*ymu1+yze1;
scaled_time1 = linspace(xze1,xze1+(xin1*nrp1),nrp1);
Finaly, ypu can plot the scaled wave data with tha scaled time data, for that you can use the stairs command or plot command
This is only for the Cahnnel 1, you must repeat for the other chanels in your MATLAB code. If you´re using a Tektronix Osciloscope, you can chek thier page for more information and a little examples for control using MATLAB software.
Hope this may be usefull for you, please tell me about it. Have a nice day and keep walking forward

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by