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.

copy and playback applicaiton with python and TDS2014B and AFG3102

Programming examples for remote communication with instruments
C/C++, C#, Python, Matlab, LabVIEW
Post Reply
cestevens95
Posts: 1
Joined: February 7th, 2017, 6:15 am
Country: United States

copy and playback applicaiton with python and TDS2014B and AFG3102

Post by cestevens95 » February 7th, 2017, 6:47 am

This information is helpful, however, I am relatively inexperienced at programming. After reading this post as well as viewtopic.php?f=580&t=138600,

It would be INCREDIBLY helpful if you could include an example (in simplest syntax possible) on the forums which uses data from an actual oscilloscope. (The TDS2014 programming manual has explicit steps about recording data from the device, however, the AFG3102 programming manual DOES NOT have explicit steps about the commands needed to output a waveform from USB)

Both of these forum examples provided merely create an arbitrary waveform from a user defined function; as I am an inexperienced programmer, I cannot successfully connect my two Tektronix devices.

I am using python to capture a waveform on a Tektronix TDS2014B and then output this waveform on the AFG3102. We can use ARB express, but it suites our purposes better to use python for automation.
I have all of the other parts of the code working, I just need to know how to convert the data from the CURV? command into data which is acceptable by the AFG.write_binary_values, as well as to reliably produce the header #<x><yyy> which comes before the <binary_block_data> for the AFG.write_binary_values

I am struggling to match the data output from the TDS2014B TDS.query_binary_values('CURV?') with the AFG.write_binary_values('TRACE:DATA EMEM') command on the AFG3102, everything else in my script works well. I just cannot get the data from the first command to be recognized by the 2nd command.

My test setup is as follows:
1)The output of channel 1 of the AFG3102 ARB is connected to the input of channel 1 of the TDS2014B oscilloscope.
2)The output of cannel 2 of the AFG3102 ARB is connected to the input of channel 2 of the TDS2014B oscilloscope.
3)Both machines are being controlled by USB. A standard sine wave is sent from the ARBch1 to the oscilloscope CH1, and a single sequence is captured on the screen. The data is captured from the oscilloscope to be output through channel 2 on the ARB, such that the oscilloscope will output the identical wave to CH2 as was captured from CH1.

The main problem arises in the TDS2014 encoding. I have tried all of the encoding types in the TDS2014 programming manual, with no success. (This is probably due to my lack of understanding about encoding).

If I use inst.write('DAT:ENC RPB') as defined in the TDS2014 programming manual, the output of inst.query_binary_values('CURV?') is <type 'list'>. If I feed this data into the AFG, there is no response whatsoever.

Any advice you can give would be much appreciated, thank you.

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

Re: copy and playback applicaiton with python and TDS2014B and AFG3102

Post by Carl M » April 14th, 2017, 4:54 pm

what you are trying to do is actually rather advanced and there are multiple ways to do it but it'll boil down to your specific requirements and personal preference.

i'm no master either so i'm constantly referencing the python library reference: https://docs.python.org/3/library/index.html.

i've moved your discussion to it's own topic because, while related to sending afg3k vectors, it is much more complicated and warrants its own discussion. also, have you seen the scope example: TBS Simple Plot? viewtopic.php?t=138685 it uses third-party modules Numpy and Matplotlib but I go over usage of python package management for easy install of Numpy and Matplotlib in my video: https://youtu.be/W5Brxiwnp5g
Tektronix Application Engineer

Post Reply

Return to “Remote Instrument Communication (Programming) Examples”

Who is online

Users browsing this forum: No registered users and 2 guests