High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization start/abort fetch by boolean control with postprocessing queue

Hello dear colleagues!
Thanks for your support, I ask you still to help to understand the following:
How correctly to supervise on/off of Fetch function? (An example of that what I did already, please see the enclosed file).

I.e. I explain conditions: it is necessary for me start/abort Fetch cycle on boolean control, i.e. then when it is necessary. 

And one more condition I wish to adhere Fetch cycle at least approximately by 1st second (in my example and it turns out).

Further, it agree my example, I consider quantity of second cycles and accordingly I understand, that Fetch have accepted so much that data for so much that seconds. Boolean control is in position true a certain interval, from 1st till 100 seconds.

The postprocessing cycle (detecting of peaks) lags behind a fetch cycle for 1 second approximately.
My example works, but it is not always correct (as it seems to me), i.e. sometimes fetch works once again than it is necessary, or on the contrary it is less.

I consider, that where that in a code I have broken sequence Fetch and Abort. 

I ask you to correct a code as consider it necessary (there it very little). 

In other words, I need somehow programmatically to distinguish, that postprocessing of a current interval of gathering (from 1st till 100 seconds) stopped and to make by this criterion some actions. 

I don't want to use any timers, there can be a turn/semaphores or new queue, etc. will help??

Sorry for my English. Please, advise me.
Message Edited by Current 93 on 11-17-2009 06:04 PM
0 Kudos
Message 1 of 4
(6,447 Views)

I had a look at your code and was very impressed with your implementation of the boolean Fetch.  I apologize I did not really understand what is wrong with the post processing.  It seems to me like it should be executing in real time as the data comes in.

 

One thing I would do is to put a stop button in your top while loop and use an OR command to combine that with the error wire, so you have some control over the stopping of the code.

 

stop.png

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 2 of 4
(6,425 Views)
Need help or advise me... please. How to use Abort function correctly in my example... I don't know how to stop Fetch after when all Points Done??    Dear Active and Proven Veterans where are you.... 8-(
0 Kudos
Message 3 of 4
(6,398 Views)

There are numerous issues with this code.  Here are the things you can do to make it much better:

  1. The enqueue in the top loop needs to be inside the Waiting case.  It will feed empty packets to the analysis loop when waiting.  This is not good practice.
  2. You have not implemented a way to stop either loop.  The previous suggestion for the top loop would probably work for both, since closing the queue will cause the bottom loop to error and exit.
  3. Your code for "x+y" would be better handled with a shift register.  Better yet, simply wire it to the iteration terminal on one of the loops.  The bottom shift register on the top loop is a reimplementation of the iteration terminal output.
  4. You could use an event structure for handling changes in things like the channel.  However, this would complicate your code quite a bit, since it would require a state machine wrapper on your analysis code and another loop for the event structure.
  5. The implementation of "texp" makes the top while loop into a FOR loop.  If your LabVIEW version is new enough, consider using a FOR loop with a conditional terminal (abortable FOR loop).
See what you can do and post your results.  If you get stuck, let us know.
0 Kudos
Message 4 of 4
(6,396 Views)