08-11-2022 11:28 AM
Hello All,
I have a code that essentially reads a pressure transducer (signal input 4-20 mA) and outputs its readings (in Atm) to an excel file.
This seems to me to be an incredibly simple code, however, my data acquisition while loop is iterating incredibly slowly (less than one iteration every second).
This is a problem for me because I plan on having a digital step motor open and close a needle valve based the measurements from this thermocouple. I will need to have a sampling speed much faster than once a second for this purpose.
Any help you can give is much appreciated!
Thanks,
Sage
08-11-2022 11:38 AM - edited 08-11-2022 11:39 AM
A while loop can ONLY iterate as fast as the contents of it can be executed. With this said, your choice of architecture and implementation is the only reason your while loop iterates slow.
You will get better performance adopting a state machine architecture and better usage of DAQmx functions, in general, 1 sample read is very slow and doing the signal processing within the acquisition loop will definitely slow you down from reading the next sample.
Edit: Just noticed that you're adding a delay inside your loop which again slows your iteration speed.
08-11-2022 11:41 AM - edited 08-11-2022 11:55 AM
You have two while loops and also some disconnected code islands. Your code is very difficult to read, mostly because you seem to hide most of the labels of terminals. These should always show.
I won't fault you for the yellow diagram background, but it is ugly and make certain parts harder to read (It has the same color as most primitives!). The only explanation would be elimination of glare due to vision problems.
08-11-2022 01:33 PM
Given that you have a WAIT MSEC function INSIDE your loop, if the control it's wired to contains anything above zero, then you're ASKING the computer to slow down.
Don't complain because the computer is doing what you ask it to (don't ask me how I know this😣)
Blog for (mostly LabVIEW) programmers: Tips And Tricks