05-24-2012 09:54 AM
Hi,
What I want to do: Read 6 analog voltages from a NI card, and supply a few digital/analog outputs from another NI card.
Here is what I am doing: I am using the DAQ assistant to acquire 6 different analog voltages on a simulated 9205 NI card. I tried simultaneously running all 6 DAQ assistant acquires (which didn't work), but I read that since there is only one clock on the card, so I cannot use multiple acquires at the same time due to timing issues (right?). Then, I put my DAQ assistants into their own frames in a flat sequence so they would operate sequentially. This runs correctly, but each frame/acquire takes 1 second to complete. Meaning that my program takes 6 seconds to do all the acquires, before my other code outside the flat sequence runs. Outside the flat sequence are my outputs (a few digital and a few analog on a slider). Because my flat sequence takes 6 seconds to compete, my outputs are only updated once every 6 seconds, where as before the flat sequence was inserted they were updated pretty much instantly.
Here are the questions: can I make the flat sequence execute faster? Or is there a way to simultaneously acquire multiple analog voltage using the DAQ assistant? I feel like I shouldn't need the flat sequence, but don't know a better way to go about this.
Hopefully that makes sense and I'm pretty new to labview so feel free to add lots of details.
Thank you!
PS: if you try my Vi, notice how slowly the top 3 inputs update, If I remove the huge flat sequence, they run very quickly and smoothly, which is what I would like.
Solved! Go to Solution.
05-24-2012 10:06 AM - edited 05-24-2012 10:07 AM
Hi gemini,
when you want to speed up a flat sequence, then you should not use it
- They are not needed in your VI.
- You can enforce dataflow by error clusters.
- If you really want to speed up your VI you should avoid the ExpressVIs. I didn't clicked into any of those collection...
- Don't use "Run continouosly" for running a VI. It's meant for debugging only.
Btw. using ExpressVis in the way you do I would call "programming a nice VI"...
05-24-2012 10:13 AM
@g e m i n i wrote:
Here is what I am doing: I am using the DAQ assistant to acquire 6 different analog voltages on a simulated 9205 NI card. I tried simultaneously running all 6 DAQ assistant acquires (which didn't work), but I read that since there is only one clock on the card, so I cannot use multiple acquires at the same time due to timing issues (right?).
Instead of trying to run 6 DAQ assistants in parallel (or sequentially), Use a single DAQ assistant that reads all channels simultaneously.
05-24-2012 10:40 AM
Hi GerdW,
You are correct, I used the error in/outs and updated my program to not use the flat sequence. Awesome!
I thought the problem was in the flat sequence (which it partially was), but I still have a few questions to follow up with. Here is my updated questions/problems:
For my DAQ assistant - I used "N-Samples" option, not "run continuously". This "N-Samples" option makes it take around 1 second for each data acquisition. After the data acquisitions are complete, then my inputs (on top of front panel) are updated. The time it takes to acquire the data seems too long (especially when I want to acquire multiple voltages in). I would like my inputs to be updated more often, so somehow I need to change the program flow or some option to speed up the DAQ data acquisition.
What I tried was changing my sampling to "1 sample (on demand)" This does exactly what I need in terms of operational speed. The inputs are updated pretty much instantly which is nice, but I don't see any output from my DAQ assistant now. (Before I had a sine wave that was updated roughly once per second now my mixed signal graph is black). How can I keep this speed, but still get data from the DAQ assistant?
Again, I attached my VI - and now have my DAQ assistants doing "1 sample (on demand)" which makes my top inputs work as I would like.
Thanks.
PS:
Btw. using ExpressVis in the way you do I would call "programming a nice VI"
Thanks, assuming you are serious
05-24-2012 10:56 AM
Thanks alternate,
I had no idea that would work - I tested it out and its working very well. It still takes about a second for the data to acquire, but this is much much better than before and the time doesn't increase for added voltage acquisitions!
05-24-2012 11:00 AM
@g e m i n i wrote:
Hi GerdW,
For my DAQ assistant - I used "N-Samples" option, not "run continuously". This "N-Samples" option makes it take around 1 second for each data acquisition. After the data acquisitions are complete, then my inputs (on top of front panel) are updated. The time it takes to acquire the data seems too long (especially when I want to acquire multiple voltages in). I would like my inputs to be updated more often, so somehow I need to change the program flow or some option to speed up the DAQ data acquisition.
No. Gerd isn't talking about the options within the DAQ assistant. He is talking about the way you run the VI. Your VI doesn't have a while loop, so when you press the Run button, it executes once and ends. That means you are probably using the Run Continuously button which is not a good idea and is only intended for debugging purposes. It is basically taking your VI and running it over and over and over again always restarting from scratch.
Almost all programs have a while loop in them that keeps code running until the time you exit your program. Imagine trying to use Microsoft Word without it. You'd have to continually click on the shortcut to work to keep restarting it everytime you wanted to type a new letter.
05-24-2012 11:08 AM
Ravens Fan,
Ohhh, I got it. Thank you for the clarification - that makes a lot of sense. I added a while loop around my block diagram, in place of using run continuously and everything is still working as expected. Thanks for the info.