09-30-2014 10:01 AM
I am attempting to improve my logging code to be separate from the main UI/logic.
I was hoping to implement a 'Send Notification' upon my trigger, to start logging in a separate while loop.
To test this, I tried the following. When my trigger goes True, a notification is sent and my 'Notification received' boolean goes True.
When I wire anything to the while loop, this no longer works:
Can someone tell me why? I was hoping to put my logging logic into this while loop to grab data from the waveform wire (brown) to log my data.
Thanks!
09-30-2014 10:07 AM
Where is that waveform data coming from? If it is direct from another loop, then that loop must finish before this logging loop can even run. DATA FLOW.
You should use a queue to send the data to your logging loop.
09-30-2014 10:23 AM - edited 09-30-2014 10:30 AM
It is indeed coming from another loop.
I see what you mean by using a queue, yes, I then receive data in my logging loop..My issue is:
How do I have the waveform be sent for as long as I need it to be, in order to log?
The wavefrom data I am receiving is 100 samples. I need 1 sample every 1ms. If there is a 'delay' of 1second, i need 1000 samples. if there is a 'delay' of 2 seconds, i need 2000samples.
I cannot use finite sample measurement because I need to update some graphs continuously so i have 'continuous samples' chosen for DAQmx Timing and DAQmx is set to -1 for the 'number of samples per channel'
09-30-2014 12:07 PM
What is the purpose of the incoming wave form wire? It is not accessed in the loop.
09-30-2014 12:08 PM
I was simply showing what I wired that led to the notifier not being read..?
09-30-2014 12:38 PM
If you're going to do data logging in the loop, then you must somehow receive the data to be logged.
As mentioned in another post, the loop will execute after the data on that wire is received, but the data on that wire will not be refreshed and passed into the while loop again.
The original incoming value(s) persist through the lifetime of the loop. That single waveform wire acts like "one bucket full of data" that goes into the loop, and you can use that data inside the loop as you choose.
The while loop runs on its own thread with its own local data, until its exit state occurs, if ever.
You won't get another "bucket of data" until you explicity call the VI that contains the loop again, passing a new value on the waveform wire.
09-30-2014 01:38 PM
belopsky wrote:
How do I have the waveform be sent for as long as I need it to be, in order to log?
You just make a queue of type Waveform (or if multiple channels use Array of Waveforms). You read from the DAQ and then just write into the queue. The logger loop will then just read data from the queue as it comes in and log it.
Just look into the Producer/Consumer if you need any more help on this.
09-30-2014 02:30 PM
Thanks, that is what I was trying, I finally got my 'trigger' to work properly..
The issue I have now is that only the first time the element is enqueued does it work..the next time nothing gets enqueued...Not sure why.
Hope this snippet helps to troubleshoot
Thanks!!
09-30-2014 02:35 PM
I question why you are limiting the number of loop iterations. And why aren't you logging the data?
09-30-2014 02:38 PM - edited 09-30-2014 02:38 PM
The limit is currently to just get exactly 1000 samples for testing (100 samples every iteration)
I cropped the logging logic out in that snippet. It is to the right.