LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

different measurement times with daqmx

Hello I am using the DAQmx software with the NI WLS/ENET-9000. I am currently using Labview to monitro voltage levels and was wondering if there was some way to be able to run tests on specific channels at different times without stopping the entire program. Is there any way to time delay or insert a test while the program is running? Do I have to run multiple VI's? or is this a limitation of the WLS?

Thanks!

 

Alvin

0 Kudos
Message 1 of 15
(3,175 Views)

Hi Alvin,

 

I assume you mean you're using a WLS/ENET 9163 carrier.  Is that correct?  What is the actual device inside of that carrier?

 

More than likely, you can create a separate Task for each channel and set the timing accordingly in your LabVIEW program.  Each Task can have one channel at a time, or multiple channels.  If you you want to control the reading on a per-channel basis, you can modify your program to have a different Task for each channel, and to handle each Task with whatever timing you're looking for.  

 

Your timing control for each Task can either be software timing (controlled by your LabVIEW program) or hardware timing (controlled by the DAQmx driver).  Could you specify which one you're looking for?  You might look at some examples or tutorials on the differences between these two.

 

I'm not certain if you're using the DAQmx lower-level VIs, or the DAQ Assistant Express VI, but it will be easier to control lines individually if you tend toward the lower-level VIs.  You may want to take a look at the Learn 10 Functions article for programming with DAQmx.

 

Hope this helps,

Andrew

National Instruments
Message 2 of 15
(3,146 Views)

Thanks Andrew,

I have an ENET9205. I believe I want to control the timing of each channel throuh Labview, and I am currently using the DAQ Assitant in Labview. Is there any way to create additional tasks with the DAQ assistant?

 

Thanks


Alvin

0 Kudos
Message 3 of 15
(3,132 Views)

Hi Alvin,

 

I don't believe there is any way to make a DAQ Assistant run two or more different tasks.  Each DAQ Assistant initializes, starts, and finishes only one Task, and that Task can include multiple channels.  If you'd like to handle other i/o channels using other Tasks, that will require you to use more than one DAQ Assistant.

 

The DAQ Assistant placed in a While Loop, for instance, will do this entire process every single time the loop executes:

1. Create the Task in memory

2. Configure the Task as you've set it up

3. Commit the Task to hardware

4. Starts the Task

5. Reads from or writes to the Task            <----------------
6. Finishes the Task by stopping it or clearing it

7. Closes out the Task reference, (which will be created again in step 1 when the DAQ Assistant is called in the loop the next time)

 

Since this process only applies to one Task, and it cannot be manipulated on a step-by-step basis.  Doing this instead using the DAQmx driver VIs (in the link I provided earlier) DOES allow you to manipulate these individual processes.  The DAQ Assistant is a convenient tool for getting started, but it isn't recommended for actually deploying a refined application.

 

Using some of the examples in the Learn 10 Functions DevZone article explains how you can use the DAQmx driver VIs efficiently. In most cases, if you are running a loop, you can condense the functions that execute in a loop down to just one function--step #5 of the list I wrote out above (look for where I drew the arrow).  This speeds up your process and makes it MUCH more efficient.  In addition, because it is more efficient, you can run multiple Tasks through your loops without taking hardly any hit on speed or memory usage.

 

Take a look at that DevZone and see if it helps with programming your application further.  Let me know how it works for you,

Regards,

Andrew

National Instruments
0 Kudos
Message 4 of 15
(3,109 Views)

Hello Andrew,

 

Thanks for the advice! I still have a few questions though. Correct me if I'm wrong, but the timing solution you have presented only works if I have a predetermined time to set the clocks at.

However, if I run a test on the DAQ over a few channels say today, then decide to run a few more channels tomorrow without stopping today's test, is the DAQ able to perform this?

 

Although I could preset a time to start taking data, this may require manually setting up the experiment at the exact time due to the nature of our experiments and is not really the functionality we are looking for. Or maybe during runtime is there a way to send the DAQ a user command (such as a keystroke) to begin sampling at a certain channel?

 

If you believe there is a better product that suits our needs better please recommend it!

 

Thanks again,

Alvin

0 Kudos
Message 5 of 15
(3,096 Views)

Hi Alvin,

 

So help me understand a little bit better--are you looking to start and stop your tasks manually, or programmatically?  

 

Also, I understand the timing for when you want to begin and end a task may change from day to day--is that correct?  So sometimes you may want to start different measurements 3 hours in, and sometimes you may want to start it 5 hours in, etc.  Are you looking to just set a time or duration and have the program do that every time, or do you also want it changeable if you decide to run a test for only 4 hours instead of 5?

 

There are a number of examples online at ni.com/examples which show how to use Case Structures in order to start and stop your DAQmx Tasks.  I searched for "DAQmx Start Stop" at that location and came up with this example, which shows how you can manually click on a button in LabVIEW to start or stop a Task  This is called a "Software Trigger" because you are triggering something through clicking buttons or manipulating LabVIEW .  Using this sort of structure, you could revise this example to do a comparison and programmatically start or stop a Task after a certain amount of time, as well.  Look here to get an idea of how to use comparison with time to control cases.

 

If you are looking for a keystroke to automate some of this operation, you can look into Event Structures.  See the online help article here.  Also, you can look for examples (as with the other links I gave) by looking around online.

 

Regards,

Andrew

National Instruments
0 Kudos
Message 6 of 15
(3,082 Views)

Hello Andrew,

 

What I am looking for may be out of the capabilities of the ENET I have. I want to have the capability of running and stopping my program both automatically and manually. I want to be able to control individual channels without stopping the Labview program.

 

For example, say I started taking samples off of Channel 1 in the morning. Then in the afternoon I built another experiment and wanted to start sampling it off of Channel 2. I want to be able to hook the second experiment to the ENET and just start sampling using Channel 2 without stopping or pausing the Channel 1 experiment. I understand that I would need to create different tasks for the DAQ to control the timing of sampling.

To be more clear:

-will not know time intervals between experiments, so cannot set up automated sampling times

-being able to manually start and stop sampling of individual channels without interupting sampling of other channels while Labview program is still running

 

Is there any way to satisfy these requirements? Would using two different programs (without the DAQ assistant) work?

 

Thanks again,

 

Alvin 

 

0 Kudos
Message 7 of 15
(3,034 Views)

Hello Alvin,

 

Although you can switch between multiple tasks, a simpler alternative is performing a continuous acquisition on multiple channels and omitting any of the waveforms that are insignificant to your test.  Rather than stopping each task individually, you can strip the wanted values when a user desires to record a selected channel.  One of the drawbacks with this implementation is the excessive amount of processing and communication throughput requirements of your system.

Regards,
Roman Sandoval | National Instruments | RF Systems Engineer
0 Kudos
Message 8 of 15
(2,994 Views)

Hello Roman,

 

The method you recommended is what I have resulted to. However, do you know of a way to change the sampling rates of each channel? Or is this impossible with this piece of hardware? If so, do you have any recommendations that will suit my needs better?

 

Thanks

 

Alvin

0 Kudos
Message 9 of 15
(2,957 Views)

Hi Alvin,

 

You cannot change the sampling rate of any task while you are running the task.  So if you have a continuous acquisition task, and you are disregarding certain samples, as Roman suggested, you will not be able to change your sampling rate while the task is running.  (The only way to do this would be to stop the continuous acquisition, change the sampling rate on the DAQmx Timing VI, and then re-start it).

 

Also, you cannot specify different sampling rates for different channels if they are in the same Task.  You have one DAQmx Timing VI per task, and that is how you specify the sampling rate.  If you want different rates on different channels, then you must use a different task for rate that you want.  

 

For instance, you could have ai channels 0, 1, and 2 in one task running at one rate, and ai channel 4 in another task running at another rate, but you will not be able to change the sampling rates on either task while the task is running.

 

I hope this helps.  Feel free to post back if you have any questions about this.

National Instruments
0 Kudos
Message 10 of 15
(2,939 Views)