LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior when using Labview to collect data from Tektronix tds8200 oscilloscope

Solved!
Go to solution

I have hit a wall in trying to figure this one out. The problem I am having is that my program does not start the oscilloscope when it should.

 

I am using a Tektronix TDS8200 oscilloscope. My goal is to collect waveform data from the oscilloscope using Labview. My program first initializes and configures the oscilloscope; this part of the program runs fine.

 

The second part of the program begins the data aquisition using the  'tktds8k Start or Stop Aquisitions.vi' function, which is equivalent to pressing the Run button on the scope. The 'tktds8k Get Waveform.vi' function is then used and should ideally return the data, which I have connected to a waveform graph for visualization.

 

When I run my program, the first part executes without issue, but as soon as the program gets to the Get Waveform function, the Run button on the scope, which is green when running, turns off; the program then times out, and no data is collected.

 

Here's where it gets weird. I went through some debugging to try and figure this out, and I put breakpoints on both the Start and Get Waveform functions so that I could step through the later part of the program. The program continues through the Start function, and the Run button on the scope is green. The breakpoint for the Get Waveform function is reached, and when I press continue, the Run button turns off and then turns back on almost immediately; the data is collected, the waveform graph is displayed, and the program exits without an error.

 

I thought timing might be the issue, so I made the program wait as long as 5 seconds between the Start and Get Waveform functions, and that did not work. I also tried moving the Start function to before the configuration functions, and removing the Start function altogether; neither method worked.

 

Are there any thoughts on why the program works when I have the breakpoints enabled and doesn't when the breakpoints are disabled? I am sure that there is an easy fix, but I haven't been able to find a solution.

 

I have attached a pdf containg information on the Oscilloscope functions (tktds8k.pdf), and I have also attached my program.

Download All
0 Kudos
Message 1 of 18
(3,680 Views)

edit - hang on.  i didn't see the bottom part of the post.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 18
(3,657 Views)

Does it work if you set the ID query to false?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 18
(3,652 Views)

I set the ID Query to False, and it had no bearing on the outcome of the code. The program still worked only when the breakpoint was set!

0 Kudos
Message 4 of 18
(3,643 Views)

The reason I asked was because I am thinking that you might have to wait for the O-scope to complete its init before you do the start thing.  Maybe you have to put a wait in between the init and the start?  I'm not good with high level drivers - I much prefer to write my own using the programmer's guide because I am a control freak in that repsect.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 18
(3,633 Views)

@billko wrote:

The reason I asked was because I am thinking that you might have to wait for the O-scope to complete its init before you do the start thing.  Maybe you have to put a wait in between the init and the start?


In that case, the OP wants to set the "reset device" to FALSE to avoid the reset.  That actually does seem plausible.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 18
(3,619 Views)

@crossrulz wrote:

@billko wrote:

The reason I asked was because I am thinking that you might have to wait for the O-scope to complete its init before you do the start thing.  Maybe you have to put a wait in between the init and the start?


In that case, the OP wants to set the "reset device" to FALSE to avoid the reset.  That actually does seem plausible.


Thanks for clarifying my muddy thoughts.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 18
(3,613 Views)

I do not have the driver installed but.  A Typical use case is to init the device configure all the vertical horizontal and trigger settings (ignoring the display settings alltogether but thats may be what you wish to see) then start the acqusition.  In fact some of those configuration parameters may need the scope in an "Idle" state to actually "Apply."  

 

After the acquisition is started you do need to wait for the trigger to happen (It looks like you are using an external trigger- Is it there?) before acquisition data is available.  "Polling" the number of acquisitions? parameter on the Tek scopes is an effective way to find out if the acquisition is complete.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 18
(3,607 Views)

Thank you for the swift replies.

 

After Bill asked about the ID Query, I decided to try a few things that I had already gone over just to double check. I was suspspicious that timing was the source of the error. Using a timed while loop, I set the wait time to 10 seconds and got results. As it turns out, 5 seconds is not long enough, but 8 seconds is a sufficient wait time for the program to work. With the problem solved, I am still mystified as to why waiting 8 seconds is required.

 

I think that the oscilloscope must be given sufficient time to display the signal on-screen before the Start Aquistion or Get Waveform functions are used. With this logic in mind, the breakpoints were acting as a sort of wait, allowing the signal to be displayed before continuing through the program.

 

In response to Jeff, I am indeed using an external direct trigger. The hardware is sound, but apparently, my coding could use some work.

 

I have attached the modified code. I am certain that there is a more elegant solution to the timing than simply slapping a timed while loop on the code. Any suggestions?

0 Kudos
Message 9 of 18
(3,585 Views)

And by "I have attached," I mean here it is:

0 Kudos
Message 10 of 18
(3,581 Views)