Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

interface help for tds 3012b scope

Hi,
I'm trying to create an interface for my oscilloscope that would continuously graph and save waveform data from both channels as well as fft data.  I started from the examples included in the scope driver tds3k that I downloaded - but the examples are fairly limited.  For instance, the single channel waveform acquire example collects just one waveform - if I want to continue acquiring data, do I need to put the read (or fetch) vi in a while loop?  If so, do I need to include the close vi inside the loop, or does it go outside it? 
 
I'm also a little confused at how to store my data.  Any examples of code to store in excel format would be greatly appreciated.
 
Interestingly, once I run the example vis, my oscilloscope traces disappear.  This is a bit unsettling, and I've only been able to fix this by pressing the 'autoset' button on my scope.  Does that mean that something hasn't been closed properly during the acquisition?
 
Thanks for your help - it's been >10 years since I've written anything in Labview! 
 
P.S.  Sorry about posting initially posting this in the labview board - I'm new here!
0 Kudos
Message 1 of 14
(5,093 Views)

You didn't mention what version of labview you are using. You could put your fetch vi in a while loop. Open and close the session outside of this while loop. As for storing your data it depends on several things. Do you need it in human readable form? TDMS might be a better option since it is not as limited as excel. I would also look into the Producer/Consumer design pattern for this app.

Just my 2 cents worth I hope it helps

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 2 of 14
(5,090 Views)
Thanks so much for your input!
I'm using version 8.0 (up until about an hour ago, I was trying to refresh my memory on Labview with a manual from version 5.0 - now I managed to get hold of one for 7.0, that should be a bit more valid!).  TDMS?  I'm not sure what that is - text something?  I'm not sure which option to use; I believe there was write to text, write to spreadsheet, and format to file?  Whichever I use, I would put that outside of the loop, correct?  And enable indexing?  Boy it's hard pulling these things out of long term storage in my brain! 

I am wondering if I need to change the configuration aspect of the vi - there is an option for setting the scope up for continuous acquisition...

Also, I suppose I would want to include all of the FFT vis in the while loop as well - but all of the configuration related vis go outside the loop, along with the triggering ones, right?  What about run - should that go in or outside?

If anyone knows of a tutorial or more advanced examples of vis for controlling oscilloscopes, I'm open to suggestions!  I'm sure this is a pretty straightforward interface to create (for someone with reasonable programming skills), and I'm sure many people have created something very similar to what I need, but I searched under everything I could think of and didn't find too much of use.

Thanks again,
Myra
0 Kudos
Message 3 of 14
(5,088 Views)
Hi Myra

Most of the exaple vi's send their settings to the scope, just reading is not a standard example.

Which of the examples are you using?

greetings from the Netherlands
0 Kudos
Message 4 of 14
(5,071 Views)

Howdy myra,

The two essential VI’s to acquire data (excluding the prerequisite o-scope configuration VI's) include tktds3k Initiate Acquisition.vi and tktds3k Fetch Waveform.vi. Conveniently, the tktds3k Read Waveform.vi contains both of these VI's and acts as a tidy little package for them. If you want to repeatedly read data from a single channel, then placing a while loop around the tktds3k Read Waveform.vi in the example and adding a Wait (ms) timer (found in Programming » Timing) to the while loop should do the trick. Don't forget to add a stop button to the loop, too!

Write To Spreadsheet File, Format Into File, and Write To Text File still exist. You can find them under the Functions Palette by right-clicking on the block diagram and navigating to Programming»File I/O. Depending on how you prefer the flow of your VI, you can either index the data and write it to a spreadsheet file outside of the while loop, or you can append the data in each iteration to a spreadsheet within the while loop.

The FFT VI’s are also in the Functions Palette under Signal Processing » Transforms.

And lastly, I must say...welcome back! 😄

Warm regards,

pBerg
0 Kudos
Message 5 of 14
(5,053 Views)

Thank you for your help!

I actually need to keep track of both channels, so I'm using initiate acquisition and fetch (for each channel) - in this case, do I need to include the initiate acquisition vi in my loop? 

I know all of this is pretty basic stuff - I guess I've just been a little overwhelmed trying to jump back into this again!  🙂

Myra

0 Kudos
Message 6 of 14
(5,045 Views)

Oh sorry,

I forgot to mention for an earlier post - one of the examples that I've been looking at is the 'single channel waveform acquire' vi from the tktds3k driver.  I think now that perhaps the reason that the traces disappear is if the vertical and or horizontal settings are much different than that of the input signal to the scope - would that make sense?  I managed to adjust the settings as closely as I could to my input signal and the trace did not disappear on the scope (that's good), but the scale settings are quite uninituitive and I'm pretty sure I'm going to have to change them around completely (that's bad 🙂 ).

Thanks!  Myra

0 Kudos
Message 7 of 14
(5,044 Views)
Hi Myra

The initiate is only needed for setting the scope,
Reading is done via fetch but only reading one channel at a time, so you need to select the channel each time in the fetch waveform.vi.

greetings from the Netherlands
0 Kudos
Message 8 of 14
(5,025 Views)

More confusion - hopefully someone can help me with some more insight...

I have a question about how to make the acquisition continuous - I tried doing it by simply putting a while loop around the read waveform vi in the 'single channel waveform acquire' vi of the driver (with no time delay).  When I varied the input signal to the scope, the response on my graph was rather choppy instead of smooth like that on the oscilloscope screen.  Is any one familiar with the time per record input for the configuration vis?  It apparently controls the horizontal scale of the graph, but does it also determine the sampling rate - I mean, if it is set to say 1 ms, does the code fetch the data only every ms, or does it acquire the data more often than that?  What I would prefer is to be able to sample the data at at least 50 kHz, but choosing the 'time per record' to correspond to that period throws off the graph (we're looking at signals between 3 and 20 kHz).  Is there another setting that I haven't seen yet to control the sample rate?

Thanks for your help everyone!

Myra

0 Kudos
Message 9 of 14
(4,998 Views)
Howdy myra,

Here's a way you can find out more detailed information about the Time Per Record input to the Configure Acquisition Record.vi (or the input to any instrument driver subVI for that matter).

1. Enable context help by pressing Ctrl+H or selecting Help»Show Context Help
2. Double-click the Configure Acquisition Record.vi from within the Single Waveform Acquire.vi block diagram. This opens the front panel for Configure Acquisition Record.vi.
3. Put your mouse over the Time Per Record control on the front panel. A detailed description of this input will appear in the Context Help window.

I don't know if you already stumbled upon this, and so I thought I'd mention it real quick for others who potentially read this thread.

Back to your original question--the Time Per Record input for your 3012 device does in fact set the Horizontal Time Per Record property of your TDS 3012. Its default value is 4.0e-3 sec, and valid inputs range from 40e-9 sec to 100 sec. For a 50KHz acquisition, you want to set this property to 2e-5 sec.

You may want to also check out the context help for the Record Length input (using the method discussed above) to decide whether you want to use a record length of 500 or 10000 to the Configure Acquisition Record.vi.

Warm regards,

pBerg
0 Kudos
Message 10 of 14
(4,977 Views)