LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cycling through Multiple Channels on DAQ-mx

Solved!
Go to solution

I'm sorry, this is a little above me experience with LabVIEW. when using a property node how do I select the property? And will I need two Start, Read, and Stop task lines within the for loop?

 

Here is where I am now 

0 Kudos
Message 11 of 22
(1,413 Views)

To get the one like in the example you want to drop a "DAQmx Channel Property Node". You can probably browse for it as well, but this is easier. Then right click on it to make the inputs "write" and left click on the inputs to select the attributes you need.

0 Kudos
Message 12 of 22
(1,409 Views)

I made some quick mods to your code to do the task config more like I was trying to describe.  I didn't pay real close attention to the formatting and file writing part so that might still need some work.   Same with error handling.  But see if the DAQ stuff works out to let you round-robin through your 8 signals.

 

Note: I don't know how you've configured your global channels.  It's possible there is more work to be done either in physical wiring or designating correct pins in the task config.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 13 of 22
(1,399 Views)

Thank you,

I am still getting an error:

Possible reason(s):

Value passed to the Task/Channels In control is invalid.

The value must refer to a valid task or valid virtual channels.

Task Name: Frequency_3

 

Not sure what it is asking for. I can do all the formatting afterwards but the channel switching are done .

 

0 Kudos
Message 14 of 22
(1,391 Views)

Those Frequency_# global channels would be defined in MAX, I have no visibility to what was set up there.   Below is a snippet to show how to do all the config on the block diagram, without involving any global channels or tasks from MAX.   Note that the default terminal names I show may not be the correct ones for you to use.  You'll have to make those terminals match the physical wiring you've done.

 

 

-Kevin P

 

preconfig more channels than counters.png

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 15 of 22
(1,383 Views)

Thanks for the suggestions on doing everything in the vi and not NI max

 

After fixing everything I am still having trouble getting my data to cycle through and print correctly. Right now it will only print one line of data for the whole time it runs. I need it to print the data from all the channels every second.

 

Here is the code:

I think it is getting tied up in the first for loop and/or the timed loop

0 Kudos
Message 16 of 22
(1,372 Views)

Can you post the data you are getting? You can hook up an indicator to the iteration terminal "i" to see if it is running multiple times.

0 Kudos
Message 17 of 22
(1,369 Views)

I would definitely recommend running in "Highlight Execution" mode (the lightbulb icon on the block diagram toggles it on & off).  I'd also toggle the icon to its right, "Retain Wire Values".

 

My guess is that somewhere in the course of the For loop, at least one of the tasks produces a timeout error, which will terminate the loop after just 1 iteration.  This can easily happen if any of the programmed terminal names don't match the actual location where the signals were physically wired.  Double-check and make sure all these match up.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 18 of 22
(1,339 Views)

I cannot upload any data, but on the timeout issue I notice that errors start in the for loop where it begins to read the channels. Is there a reason that this cannot be run simultaneously? I think that is the main issue, that one bank of channels is read before the other and the program shows a timeout error on the second bank while waiting for the first side to be read.

0 Kudos
Message 19 of 22
(1,302 Views)

1. First verify that the error tunnel coming into the reading For loop has no error on it.

2. Then either probe or make an indicator for each of the arrays of errors coming out of the For loop via tunnels.  This will identify exactly which one(s) of the 8 tasks produces an error and what it is.

 

In general, reading from two different Ctr Freq tasks in the same loop will not interfere with one another.  They can operate in parallel just fine.  I expect the error(s) you get are either due to a missing freq signal somewhere, possibly due to a mismatch between programmatic config and actual physical wiring config.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 20 of 22
(1,294 Views)