キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

sampled while loop

解決済み
解決策を見る

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 件の賞賛
メッセージ1/9
4,639件の閲覧回数

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

0 件の賞賛
メッセージ2/9
4,622件の閲覧回数

Yeah here it is.

0 件の賞賛
メッセージ3/9
4,616件の閲覧回数

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 件の賞賛
メッセージ4/9
4,611件の閲覧回数

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.



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
メッセージ5/9
4,598件の閲覧回数

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

0 件の賞賛
メッセージ6/9
4,594件の閲覧回数

@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.



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 件の賞賛
メッセージ7/9
4,510件の閲覧回数

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 件の賞賛
メッセージ8/9
4,483件の閲覧回数
解決策
受理者 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.



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 件の賞賛
メッセージ9/9
4,475件の閲覧回数