07-06-2021 03:42 PM
Hi! I am new to Labview. I am using Labview 2013 and an NI USB-6259. I have tried to create a program that generates and outputs a burst modulated pulse current based on inputs from analog sensors. I was able to successfully complete an initial working version, however, the loop that contains the DAQ assistant to collect the sensor data and generate the signal is only iterating 10 times per second. The signal I am ideally trying to generate needs to be close to 30 Hz, so my current program is far too slow.
It is currently set up to generate a single value for the spike function per iteration, and all of these values are put together to form the signal over time. I have tried de-cluttering my program to make it run faster. I have tried generating the signal in a different while loop. I have tried changing the loop to be a timed loop at 1 ms, but this still results in only 10 iterations per second.
I have recently tried in another version to scrap my entire approach for signal generation and to instead use DAQmx to generate an Analog Output Function Generation pulse train, but I am unfamiliar with how this works. Despite looking through the forums, I have been unable to create a version without errors that can run. I currently have it set up to where an amplitude and frequency input is fed into the DAQmx Create virtual channel; this connects to the DAQmx Timing.vi with the implicit setting; this connects to the DAQmx Start Task Vi. These occur inside my flat sequence structure, but outside of the while loop which my DAQ Assistant and analysis code is contained in. It is then fed into to while loop, and into a for loop (set to N=10) to ideally make it run 100 times per second as opposed to 10 times. Inside the for loop is a True/False case structure. When true (based on the analysis of the sensor data), the DAQmx Channel CO.Pulse.Freq is created and cleared outside the inner for loop. When false, it is simply passed through the case structure and the task is cleared.
In general, I would appreciate any advice some of you may have with respect to how to successfully get my code to execute so that the signal generated can be as fast as 30 Hz. This could be through decreasing the runtime of each loop iteration, creating the signal another way, or any other suggestions you may have. Also, despite the fact that 10 points of data are generated per second, it is not actually successful at generating a 10 Hz signal; the most it has done correctly is 5 Hz I believe. Thank you so much for your help!
I have attached both screenshots of portions of the code, and a copy of the VI (the one which functions properly just not at a fast enough rate).
07-07-2021 09:52 AM
Here are some general principles to write any LabVIEW program to do any serious work:
Bob Schor