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.

Reading Channel data using VISA communication

Post Reply
marques789
Posts: 3
Joined: June 28th, 2017, 8:16 am
Country: Portugal

Reading Channel data using VISA communication

Post by marques789 » June 28th, 2017, 8:20 am

I'm currently trying to read channel data from the model DPO77002SX with an ethernet cable to matlab using VISA. I'm using a matlab function ("ScopeF" that is gonna be attached) not created by me, but from my coworker. The software he gave supposably works in another model(DPO70000 series i think). The problem is as follows when i use the function, the osciloscope does connect to the laptop but it gives the error "osciloscope has no signal" which means the dpo.TransferStatus doesn't go to idle and i'm not sure why. Also when i run the function it disables some channels in the osciloscope. I'l try to feedback as much as possible but keep in mind i did not write this code. If you have any ideas on why it is not working i would aprreciate it.
Attachments
ScopeF.zip
(1.76 KiB) Downloaded 1145 times

Scott H
Tektronix Applications
Tektronix Applications
Posts: 21
Joined: July 3rd, 2013, 9:29 am

Re: Reading Channel data using VISA communication

Post by Scott H » June 29th, 2017, 1:36 pm

Hello Marques,
I looked over your Matlab script and your coworker will have to rewrite it to be compatible with the DPO77002SX. A few problems I see are:
1) You have a 'for loop' which loops through settings of four channels. This will cause a problem since the DPO77002SX only has three channels (not four).
2) Furthermore channel 2 on the scope is the ATI input. You can only use channels 1 & 3 OR channel 2. So as the loop first mentioned changes to and from channel 2, it'll turn off or on appropriate channels.
3) The third problem I cannot explain why but did notice that 'readasync(dpo)' in your MATLAB script isn't actually reading; which in turn is causing the timeout to send the message 'The oscilloscope has no signal'. Using the 'fread(dpo)' command will read the waveform.

marques789
Posts: 3
Joined: June 28th, 2017, 8:16 am
Country: Portugal

Re: Reading Channel data using VISA communication

Post by marques789 » June 30th, 2017, 8:31 am

Thank you very much for the help. I will try to rewrite the code according to your input. What really bothers me is why doesn't the 'readasync(dpo)' work, but i will try to use 'fread(dpo)' as you suggested.
Thanks again for the reply.

marques789
Posts: 3
Joined: June 28th, 2017, 8:16 am
Country: Portugal

Re: Reading Channel data using VISA communication

Post by marques789 » July 6th, 2017, 7:53 am

Hi again,
I rearrenged the code so it only selects the first and third channel. Tried using the 'fread(dpo)' command to read the waveform but it just says 'Timeout expired before operation completed', furthermore the 'dpo.BytesAvaible' is always equal to 0 so it is not able to aquire data. I'm not quite sure what commands are wrong in the code. What is the simplest way of reading osciloscope data in matlab using visa communication so I can try it?

Scott H
Tektronix Applications
Tektronix Applications
Posts: 21
Joined: July 3rd, 2013, 9:29 am

Re: Reading Channel data using VISA communication

Post by Scott H » July 6th, 2017, 10:44 am

Hello,
'fread(dpo)' is not a drop in replacement to 'readasync(dpo)'. 'readasync' will read from the object and store in the buffer; while 'fread' will read into an array. If you do not assign a variable to store the array from 'fread' then using that command will only clear the buffer from the scope.
For examples to use MATLAB with our products, refer to this link:
viewtopic.php?f=580&t=133570#p278645
For an example MATLAB code reading the data from the scope, refer to this link:
viewtopic.php?f=580&t=139099&p=281862#p281862

Post Reply

Return to “Programming Support”

Who is online

Users browsing this forum: No registered users and 16 guests