05-03-2018 06:42 PM
In the 1-Ctr version, you configured your pulse width counter differently (and wrongly) compared to the full code. You need implicit timing and don't need the triggering. Counter input tasks aren't allowed to configure a regular Start Trigger, they can only use the Arm Start Trigger. But I don't think you need it. You'll be implicitly timed by the pulse generating counter which *is* triggered.
(BTW, I didn't catch this before but the counter output task that *does* use an Arm Start Trigger would be allowed use the regular Start Trigger. Just FYI for future reference.)
Attached are just a few simple mods I did to your top-level main program "Imaging.vi". More could be done, but here's what I changed:
-Kevin P
05-04-2018 07:32 AM
Kevin,
I have tried to put the commit action before the main loop. Apparently, my USB board doesn't like it. It gives an error 201025: Possible reason(s):
Non-buffered hardware-timed operations are not supported for this device and Channel Type.
Set the Buffer Size to greater than 0, do not configure Sample Clock timing, or set Sample Timing Type to On Demand.
I have looked up on internet and it is suggested to put the Write daq before the Start task, but I can't go this way in my program, right?
Thanks for the error wire changes
05-04-2018 09:14 AM
Let's keep trying on the task commit.
I looked up this KB article on that error. I have 2 suggestions for you:
It should be fine to put the DAQmx Write before your main loop since all the data is defined before the main loop.
-Kevin P
05-09-2018 04:41 AM
Ok, I will try both and keep the "commit" action.
Another thing is saving data. When I need to save the vectors with intensities not only display them, the program execution time grows by roughly 50-70% for each cycle.
My idea was either to stop image updating while saving data or to make images in the program itself without saving the data (IMAQ, etc.)
What do you think about it?
Thank you
05-09-2018 08:24 AM
No, that'd be solving the wrong problem.
As has been suggested multiple times in the thread, the *most important* thing you should do to improve your loop cycling time is to move *all* processing, gui updates, and file writing into another independent loop. Put all the data coming out of your DAQmx Read calls into a queue, and let the other loop dequeue all the data and do all the processing work.
This frees up your DAQ loop to cycle back to the next iteration while the processing proceeds in parallel.
-Kevin P