08-07-2015 07:20 AM
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?
Solved! Go to Solution.
08-07-2015 07:31 AM
It looks as though the DAQ task isn't created correctly. Can you include the "test.vi" that is initialiasing the DAQ task?
08-07-2015 07:34 AM
Yeah here it is.
08-07-2015 07:37 AM
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
08-07-2015 07:54 AM
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.
08-07-2015 07:57 AM
Is there any way to set it up so the loop ends when two data points are collected vs a time.
08-07-2015 11:19 AM - edited 08-07-2015 11:38 AM
@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.
08-07-2015 12:06 PM
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.
08-07-2015 12:14 PM
@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.