LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me with Dual Daq Dual card VI

I know the Tc-2190 card is limited to 1s/sec but i cant achive that. Can sombody take a look at this?
 
Ill post more details in a fe moments (restarting server)
 
 
0 Kudos
Message 1 of 10
(3,004 Views)

Ok here is the basics:

This is my first ever Attempt at MX. I know nothing about it.

Im using TWO cards, one must use MX, the other Must use Traditional. The two cards are a PCI-6221 (scb-68) which is MX only, and  The NI 4351 for PCI, which i am using With the TC-2190. The 4351 can only be used with Traditional.

Now  the 4351 claims some variable bitrate, with 2.8S/sec as the minimum rate, i can't seem to get more than 1s/sec in this Vi. Perhaps too much going on? im reading 11 Temps.

In the datasheet for the 4351 board the sample rate is listed as 9.7, 8.8, 2.8 What nuber do i use? I see not explanations for the condidtions of these 3 diffrent numbers.

Am i using the MX correctly? Its my first attempt, i felt a bit odd usig the traditional index array after it. Is that the correct thing to do?

 

 

 

0 Kudos
Message 2 of 10
(2,993 Views)
Well, you are doing a lot of post-processing with all of those mean calculations and then you are writing strings to a file with every iteration. Your traditional DAQ function is set for 1.5 scans/sec so it will take .667 seconds for the single sample and that doesn't leave much time for everything else. None of the Index Waveform and mean functions are required for the temp data. Set your AI Acquire Waveform to return a scaled array. This will be a 2D array and you can get the first value in every row with a single Index Array function. No need to do a mean because you only have a single sample per channel. I would also recomend using the discrete DAQmx functions instead of the DAQ Assistant. There are plenty of shipping examples you can look at. I'm not sure if there's a quicker way to get the mean of every channel in your DAQmx task but you can save some time by writing as a binary file. If you need it later as a text file, you can post-process the binary file and rewrite it. How long does this program have to run? If it's not too long, you could defer all analysis and writing until the while loop stops - keeping your data in a shift register.

Message Edited by Dennis Knutson on 05-23-2006 12:20 PM

Message 3 of 10
(2,990 Views)

Thank you very much Dennis. I value your responses even more than the ones from NI themselves!

So i will delete the extraneous means in the single sampling area.  

About the writing strings, It seems as if i dont i get strange symbols in the output text file?

1.5 S/sec is the fastest value the card will allow as an input.

QUESTION: is it possible two do TWO while loops, one for the faster card, another for the slower card. In the data file the values from the faster card would change every point, but the temperture values would just repeat untill the next value came out of the loop?

Is that something you could show me how to do?

What would be the advantages of using the seperate blocks instead of the DAQ assistant? Remember you are the best programmer there is and i know almost nothing.

Are there any good labview programming books? Labview for dummies?

A slightly updated version of the VI.

 

 

 

 

 

 

 

0 Kudos
Message 4 of 10
(2,979 Views)
Thanks for the compliment but I would never say I'm the best. Old and somewhat experienced would be a much better description.Smiley Very Happy
 
The DAQ Assistant is designed for ease of use - not necessarily speed. You'll gain a little bit by just having the DAQmx Read inside the while loop. That way the assistant won't be doing a stop task and control task with every iteration. You can copy everything from the opened VI to your existing main. Put everything before the DAQmx Read outside the while loop on the left. Put everything after the DAQmx Read outside the while loop on the right. Connect task and error connections to enforce data flow.
 
Sure you can have separate while loops. You can pass the data from the while loop with the temp measurements to the other with a local variable or a queue. I've done a very simple example that usings a local.
 
The attached example doesn't do any file writes. If you save the file as binary, you will not be able to view it in any text reader. It would need to be converted. As I said though, it is much faster to write binary than text. I suggest you see what kind of loop speed you get without any file write, with binary write, and with a text write.
Message 5 of 10
(2,969 Views)
Here is an example using queues. It does not have any DAQ, simply passing the iteration counts for simulation.

Lynn
0 Kudos
Message 6 of 10
(2,963 Views)
When i try to open theTwo While loops vi, it askes for the sub-vi also called Two while loops.
 
Any advice Dennis? Circular reference?

Message Edited by Vr6Fidelity on 05-23-2006 04:22 PM

0 Kudos
Message 7 of 10
(2,958 Views)
It opens okay for me but I'll reattach anyway.
0 Kudos
Message 8 of 10
(2,940 Views)

Wow, That is quite different indeed. I owe you years of indentured servitude.

Let me see if i grasp the significance of your changes.

1. You are using MX as your primary driver for tasks such as file operations.

2. You are using For loops for almost everything. I find this interesting as i have never used one of these. I know basically what it is, it is just a cleaner way of having all my index arrays lined up. My question is this: Does this have a performance benefit? I tend to just have multiple Index arrays for the sole purpose of easy access to the data as i need to make front panel graphs and indicators for every channel.

3. Is there a reason you dont like the daq assistant? Using the explicit MX call seems to add a lot of complexity and requires skills and programming knowledge i just dont have in my toolbox yet. For instance How do the Explicit MX calls know what channels to use for each page of the for loop and what scale? It hard to visually see what goes where.

4. The most important question of all. If i were to split my simplistic VI into two loops and i wrote the output array into a local variable sent to the fast loop, the numbers written to the data file would just update as fast as the slow card but would not slow down the fast loop correct?

 

0 Kudos
Message 9 of 10
(2,926 Views)

DAQmx has nothing to do with file operations. I simply replaced the DAQ Assistant with the functions that it was using. I'm more comfortable using the functions instead of the assistant and there is a slight performance benefit. I started using DAQ a long time ago and am just used to individual functions. I also like to see how things are configured on the diagram instead of opening the assistant to view or make a change. Every input to the DAQmx Create Channel inside the for loop, is an array. A for loop auto-indexes array inputs. With the first iteration, it uses the first element in each array. The second iteration uses the second element and so on. If you had the same configuration for every channel, you wouldn't need to use a for loop at all. You could also use separate, individual, DAQmx Create Channels chained together.

I'm not sure if there is much of a performance benefit to using a for loop instead of multiple index array functions. There may be but it certainly makes the diagram less "cluttered". If I need to display something, I will use an array or cluster to display everything instead of individual indicators.

If you use two separte while loops and pass the data acquired from the traditional DAQ loop to the DAQmx loop, each loop will run independently. If you choose to put the file write in the fast loop with a local variable, it will request the data from the other loop with every iteration of the fast loop whether there is a new value available or not.

0 Kudos
Message 10 of 10
(2,921 Views)