11-16-2017 03:58 PM
I tried what you suggested, using Continous Timing. However it was very slow when triggering was enabled with the Start Task and Stop Tasks there.
More than 700ms per frame where before with the Finite Samples with bizarre Sequence structure and 1024 samples was at 70ms.
I removed the explicit Start and Stop tasks and the time went back to 70ms per frame and is consistent over # of samples but the triggering slowly de-phases and I get a can't keep up message after stopping my program. What I mean is I'm injecting a test square wave to the ADC syncd to the external trigger and it should be high for the first 500 samples and low for the next 500, but it slowly walks across the screen after each loop.
If the software timed stop and starts are not good, can I hardware inject a stop/start? I'm triggering on an external digital edge anyway...
11-16-2017 04:19 PM
Okay, after reading the knowledge base article of -200279 I placed the DAQmx Start/Stop in the outer loop to give the ADC a rest between each set of 150 acquisitions and that solves the marching square wave problem and the -200279 error.
So to summarize, if you need to monitor a bunch of measurements quickly by an external trigger to sync things and dump the frame of each group of measurements for processing its best to:
- Use Continuous Mode
- Make sure the Sampling Rate vi and Read vi are wired to the same number of samples (-1 doesn't work well for some reason for continuous mode)
- Put the Start/Stop in the outer loop.
If there is some place to read about re-triggering and things like that, please let me know. There's a lot of fracturing with example code and KB articles with the different versions of labview (For example, I clicked a KB article link for the 'latest' DAQmx drivers and it was a link to version 14.1...)
11-16-2017 04:23 PM - edited 11-16-2017 04:30 PM
Oh dear, I misspoke.
There is still a problem.
Somehow 1000 samples is a magic number for phase alignment of all 150 measurements.
Other sampling numbers give de-phased triggering responses...
Ah, the de-phasing only occurs below 1000 samples, its weird.
Wrong again, its only correct phase for multiples of 1000 samples. No matter the sampling frequency. I'll think about this tomorrow.
11-16-2017 04:38 PM
Okay, I see what's happening.
DAQmx Start vi is the vi that primes the trigger for the external digital edge. This gets triggered in the outside loop then the continuous acquisition starts. Then the external trigger is ignored for the inner loop and because I'm triggering at 10kHz it matches up with this by chance. Or whatever.
Is there anyway to re-arm the trigger for every internal loop like I'm doing with the finite sampling? If I try putting in the Start/Stop to the internal loop for Continous Acq it becomes very slow.
11-16-2017 05:24 PM
Wanting to help, but a little frustrated at the moment b/c all your posted code has shown a no-triggering configuration. Your recent messages make it sound like you actually *use* triggering when running the experiments *and* that the trigger signal is repeating at 10 kHZ!!!
This is very relevant information that I wish was made much clearer much earlier. (Part of the fault is mine -- I've also been dealing with other threads where the poster kept using the word "trigger" where the word "sample clock" belonged. This is kinda common on the forums, so I've come to sorta gloss over people's verbal mentions of triggers and take my cues from the code. Peoples' verbal descriptions often turn out to be inaccurate.)
Anyway, can you please give a more thorough description of *all* the relevant timing signals involved? That includes all triggers and sample clocks for all tasks involved in this app. Which ones do you control and which are you reacting to? Which repeat and which are one-time only? Of the ones you have to react to, can they assert themselves while you're in the midst of configuring and starting your tasks? In other words, do you have to consider them to be potentially present at any moment? Or do you have some limited control or knowledge over when they could possibly assert?
My reply in msg #8 has a link to a method that would allow for hardware-based retriggering. The best solution is going to be all hardware based if you can get there from here. Anything involving software timing or lots of task starts and stops will inevitably be sub-optimal. And so all these odd & intriguing details are not really the place to focus until *eliminating the possibility* that there's a hardware-based solution.
Again, the approach you've been taking has all the appearance of a sub-optimal solution. Let's stop trying to polish and shine it until we're sure you have to be stuck with it.
What's the big picture here? Why are you wanting to cycle 150 times through a Start-Read-Stop sequence? Is there some condition that should initiate each individual cycle? Or would you simply like to break up a continuous stream of data into 150 distinct packets?
Further, you're looping through that whole 150 iteration loop repeatedly as well. What condition should initiate each of these outer loop cycles? Again, could the task simply run continuously in hardware if you used software to organize the data into the right size chunks?
I'm just no sure we've been focused on the right problem to solve. Instead of ironing out the kinks in a sub-optimal approach, let's change the whole approach (if possible) to something better.
-Kevin P