Showing results for 
Search instead for 
Did you mean: 

daq bnc2120

Go to solution


The code should work as you suggested. The only reason it would behave that way is if the true case is never entered.

Have you been able to step through the program in debug mode, and make sure everything is working as expected?

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 11 of 16

The true case is executed but during the false case the values are shifted all the time and so the display after the subtraction (in the true case) is zero and hence it always displays zero.

So the problem is with the false case.


The attached file shows an error:

'Resource file not found. The file '' is not a valid LabVIEW file'.

0 Kudos
Message 12 of 16


That attachement didn't work. Could you repost that code?

I don't have your counters set up, but I will try to replicate the behavior on my end.

Did the code I sent you work as expected?

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 13 of 16

The file you sent does not work.

I have again attached my program this time.



0 Kudos
Message 14 of 16


Sorry, I now attached a version you should be able to use.

It is your program with a "fake" counter.

The program behavior is as expected.


The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at:

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 15 of 16
Accepted by topic author fhs_dur

Thank you for the reply.

Yes the logic of the program is correct. In your attached file, the delay of the loop is 500ms so each 2.5 second the true condition is reached and is delayed for another 0.5 s. This may not happen in the real case, as it depends on the frequency of the signal.


However true the logic of my program is, it does not work in a real system with DAQ.


If i put a breakpoint and observe the value in true case, it works but in false case the difference is always zero.


This only happens if the true case is also executed in false case, which is impossible.


However, i have managed to solve the problem by storing values in an array continuously and subtracting two consecutive values of the array each time of the loop, and this works very well.



0 Kudos
Message 16 of 16