LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering single-sample collection on Daq 6009

Highlighted

Hello everyone,

 

I'm starting to branch into sections of labview I haven't used before and I'm having some issues.

I wrote a program (see attached) to periodically take voltage readings from multiple outputs of multiple 6008 boards. It works great, but because the input current to the parts I'm testing is a square wave, the readings alternate between positive and negative values.

Not a huge issue, but I thought it would be simple enough to set some kind of trigger so that it samples only the positive values. So far I haven't been able to get the 'trigger.vi' to work.

 

Suggestions?

0 Kudos
Message 1 of 6
(322 Views)

Hi there, can you post a picture of the data you are getting, and the data you want to get?

 

Also, no need for the greedy while loop at the beginning, you can use an event structure.



CLA // LabVIEW 2016 // BALUG // Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 6
(291 Views)

Do you mean that you only want to LOG the positive values to the file?

If so what you need to do is

1) Acquire

2) Analyse (simplest for you would be the greater than function from the comparison pallete, you can compare the array of double to an integer or an array of integers)

3) Present (Log the data & Display ; if the comparison is TRUE, update, if not don't - use a case structure. You could also use the comparison functions "AND array" "OR Array" to help make this decision if it helps.)

 

Hope this is the answer you were after.

 

(Note, your loop will run slower over long running times as the file fills up if you have lots of data in it, you should think about moving analyse, present to a slave loop)

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2012 - 2016 installed
0 Kudos
Message 3 of 6
(283 Views)

The program does this:

 

1) wait a set amount of time

2) take a voltage reading from each ao on four devices (one sample each)

3) repeat

 

Right now, half the values are negative because the current being supplied to the parts I'm measuring is a square wave, so if it samples in the 'positive' current you get positive values, etc.

 

I just want it to wait until the samples are positive before taking the data.

 

I suppose I could do a TRUE/FALSE comparison, but that seems like a really sloppy way to do it. Isn't there a simpler way to just have it wait until the numbers are positive rather than designing it for both cases?

 

 

PS

The data logging doesn't slow down at all in my experience. I've run this for 60 hours straight. The program isn't dealing with a full spreadsheet, it just exports one line of data at a time as text and appends it to the end, so each loop is just as fast as the one before it. Unless I'm missing something, but again, 60 hour test.

0 Kudos
Message 4 of 6
(272 Views)

I would post the data, but it's pretty meaningless. Looking at the data from an individual ao, it'll either be 2V or -2V, depending on when it's sampled (the current supplied to the parts I'm measuring is a square wave, so it alternates).

If it happens to be sampled in the 'negative' portion, I'd just like it to wait a bit and sample from the 'positive' portion instead, or better yet, have a trigger that waits for the values to change from negative to positive before taking the sample.

Also, I've never understood the benefit of event structures. I understand their use for more intricate programs, but if I just need something simple like this, I'd much rather keep it easy and straightforward so when some intern comes in to try and make changes to it, he's not in over his head.

0 Kudos
Message 5 of 6
(268 Views)

I had an external device that had a push-button that when you pushed it, generated a Stimulus + flashed an LED.  For complicated reasons, I couldn't get to the Push Button signal -- a colleague built a sensor that I put over the LED to generate a TTL pulse when the LED flashes.

 

I wanted to take 50 samples at 1 kHz from an accelerometer in response to the Stimulus.  I configured the DAQmx AI Task to start on a rising edge of PFI0, and I connected the TTL signal to this terminal of the USB-6009.  So once the Task starts, the DAQ device basically waits for the TTL pulse, then acquires the data.

 

You might be able to do something similar.

 

Bob Schor

0 Kudos
Message 6 of 6
(257 Views)