LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sampled while loop

Solved!
Go to solution

I am using a NI 9401 mounted on NI cDAQ-9174 with a two digital fiber sensors attached. When something breaks the laser it sends a signal to the board. I am using this experimental code, playing around with a few things to try and get it so "see" one of each edge then stop.

 

I'm trying to get a while loop to end when one edge from each series is collected. Right now it ends on the "timeout" time. Any ideas?

0 Kudos
Message 1 of 9
(3,386 Views)

It looks as though the DAQ task isn't created correctly. Can you include the "test.vi" that is initialiasing the DAQ task?

0 Kudos
Message 2 of 9
(3,369 Views)

Yeah here it is.

0 Kudos
Message 3 of 9
(3,363 Views)

Is looks as though you've got the DAQ sample buffer set to 100 samples, and are then trying to read 1000 in one go

0 Kudos
Message 4 of 9
(3,358 Views)

As a general rule, if you are using Continuous Samples, just leave the Samples Per Channel input on the DAQmx Timing VI unwired.  It defaults to a large buffer.  This just makes one less thing for you to worry about.


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
Message 5 of 9
(3,345 Views)

Is there any way to set it up so the loop ends when two data points are collected vs a time.

0 Kudos
Message 6 of 9
(3,341 Views)

@Neil_Helsel wrote:

Is there any way to set it up so the loop ends when two data points are collected vs a time.


I typically will send some type of command to tell the consumer loop to stop.  In this case, I would use an empty array as my stop command.

Nevermind.  I was thinking of another thread...

 

You can stop your collection loop based on whatever criteria you want.  If you are talking about running for X time, then I would keep a count of how many samples you have collected and stop when that number goes over the number of samples to cover your desired time.


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 7 of 9
(3,257 Views)

I'm sorry I meant right now I have it set to a time and want it to stop when a value becomes true for both DigitalIn_0 &DigitalIn_1.

0 Kudos
Message 8 of 9
(3,230 Views)
Solution
Accepted by topic author Neil_Helsel

@Neil_Helsel wrote:

I'm sorry I meant right now I have it set to a time and want it to stop when a value becomes true for both DigitalIn_0 &DigitalIn_1.


Sounds like a simple AND when looking at the two channels.


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 9 of 9
(3,222 Views)