LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change channel to acquire- programmatically while running

dear friends,

 

how can i change the channel to acquire from while currently running and showing the waveform on a graph continuosly, in my code if i change channel number it should show corresponding acquisition on graph.

 

i am trying to stop when boolean true and then read again from new channel number and start again, but it gives me error/ nothing happens.

i tried using even structure to check for value change of the channel selector(numeric) and then stop and read, but nothing happens..

i tried to change the daqmx read "property node: channels to read" but gives me error..

 

any ideas,

Thanks in advance

 

0 Kudos
Message 1 of 7
(4,475 Views)

But you are not adding a channel. You are trying to add a task and the way you are doing that is incorrect. If you were using a DAQmx Create Channel (i.e. outside the loop) and inside the true case, another DAQmx Create Channel so that you added the channel to the stopped task, it would probably work. Use a shift register to hold the task. See the attached file.

 

No matter what you do, you will not be acquiring continuously. You have to stop the task in order to add/remove channels.

0 Kudos
Message 2 of 7
(4,464 Views)

Thanks for the reply dennis,

the VI gives error 200489, i think its not able to update channel name as expected. also if the channel name is outside while loop it wont be updated when i change while running and will be giving out same task i believe, plz clear my understanding.

 

I have attached the VI with numeric to string for channel name+number, since the selection procedure happens from a numeric control on FP in my requirement.

even if it takes around 1 sec to stop task and start again, it would still be useful.

 

problem is i have 60 channels to read from and thought to make each case for each channel with corresponding name, but is there a better way to do it.

final goal is i need to be able to select a channel and view its graph without stopping the program.

 

any help is much appreaciated,

Thanks

0 Kudos
Message 3 of 7
(4,441 Views)

Use Simple Statemachine to Programatically handle the configure,read,clear states of the channel.

Hopes this helps.

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
Message 4 of 7
(4,428 Views)

Thank you so much, it worked great..

 

i have 2 more cases though..

 

how can i read multiple/ or all channels at once. i have total 60 channels

 

any ideas, i am assuming for loops etc...

 

 

0 Kudos
Message 5 of 7
(4,390 Views)

One DAQmx Read with all of the channels in the task - 1 to 60. It's all the same. No loops.

 

Have you seen DAQmx Getting Started. You should be able to get all of your basic questions like the above answered there.

0 Kudos
Message 6 of 7
(4,382 Views)

There are N number of examples for DAQmx as dennis told.Check my simple programme for multi channel aquistion.hope this helps.

Multi Channel Acquistion.JPG 

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 7 of 7
(4,361 Views)