LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you toggle between multiple channels to indicate from which channel to acquire data from?

Solved!
Go to solution
I am trying to builld a VI where I can have an option to turn ON or OFF multiple channels according to the modules plugged into the chassis and then acquire data from the channels that are ON and where the other acquisition parameters do not change. Is there any specific function/control where I can do this? Please reply as soon as possible. Its pretty urgent. Thanks
0 Kudos
Message 1 of 28
(3,362 Views)
Solution
Accepted by topic author ksurdi

Are you using DAQmx?  In order to change the channel assignment for acquiring data, you need to close the currently open session and then create a new session with the new channel definition.  So the order of execution would be:

Create Task or Virtual Channel - setup timing and triggering - Read - Clear Task - define new channel list and Create Task - read - Clear Task, etc....

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 28
(3,347 Views)
Here is a system that is simplified from what I normaly use. It is a state machine system that we developed. The bottom loop is the AI loop. Look at what we have done and this should get you stated. Let me know if you have questions.
Tim
GHSP
0 Kudos
Message 3 of 28
(3,341 Views)

Hi,

  Thanks a lot for the help. what I am trying to do is to setup a VI which gives me an option where I can just turn ON or OFF the channels that i do not want to acquire the data from, but keep rest of the sampling parameters same. So suppose I have 16 channels but I want to acquire continuous data from only 4 of the channels, I should be able to turn only those ON and take the data. So I should be able to do that using my front panel. May I attach the V that i have right now?

Thanks.

0 Kudos
Message 4 of 28
(3,326 Views)
If you attach it then we can look at what you are doing and give you some advice.
Tim
GHSP
0 Kudos
Message 5 of 28
(3,324 Views)

ok. thanks. Here is my VI.

0 Kudos
Message 6 of 28
(3,319 Views)
and I am sorry but do you have the example VI that you sent me right now done in a previous version of LabVIEW like may 8.5? I have LabVIEW 8.5 installed on my computer and I cannot open the one that you sent me.
0 Kudos
Message 7 of 28
(3,313 Views)

Make your Lab1_Trial2 vi into a subvi.  Wire the physical channel control to a terminal in the terminal pane.  Call from a main vi where you pass in the physical channel.  Whenever you want to change the channel, you must allow the subvi to end, then call it again with a new channel.  You cannot change the channel on the fly because that messes up the session.  The session must be closed and re-opened with a new channel.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 28
(3,308 Views)

Did you look at the system that I sent you? If you take a look at it everything that you need is in what I gave you. How are you setting up your channels? The easy way is to set up global virtual channels. If you set them up then put them as the default values for your program then all you have to do is add booleans to the front panel and build your channel array when a button is pushed.

 

 

Do you know haw to build global virtual channels in DAQMX?

 

 

If so Set up two analog input channels channels named:

 

MyVoltageChannel1

MyVoltageChannel2

 

Then start this Main.VI and see what happens

 

Tim
GHSP
0 Kudos
Message 9 of 28
(3,302 Views)

Pretty nice system aeastet.  A value change event triggers all the states necessary to reconfigure the channel list.  Are your VIs in 8.5?  That is what the OP has.  He mentioned that he couldn't open your previously posted VIs.

 

I don't know the OP's level of experience, but this would be quite overwhelming for a beginner to absorb.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 28
(3,293 Views)