03-15-2012 12:32 PM
Hello,
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?
03-19-2012 08:43 AM - edited 03-19-2012 08:45 AM
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 'daqbnc.vi' is not a valid LabVIEW file'.
03-20-2012 11:52 AM
Hello,
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?
03-22-2012 11:45 AM
The file you sent does not work.
I have again attached my program this time.
Rgrds,
03-22-2012 01:07 PM
Hello,
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: http://ni.com/samplecodelicense
03-27-2012 09:28 AM
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.
Thanks.