LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DaqMX create channel


@DavideB wrote:

Now I have the problem to connect the task out and error out pins of two DaqMx read objects. How can I fix that?


No, you have two different tasks.  Each task should have its own read.  You can use Merge Error if you want to combine the errors.  But the task wires should remain separate.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 22
(621 Views)

I merged the errors because I cant think of any other alternative to manage them.

But what about the tasks? I have two DaqMX read objects. Task should go into the DaqMx clear task (I think), which is one. Should I have two? If yes, how can I connect the previous code to them? now it is only one flow and I dont want to duplicate the whole code.

Thanks

0 Kudos
Message 12 of 22
(605 Views)

With two tasks, you need two clears.

Or at least, you need to call DAQmx Clear for each of them.

 

If you have several operations to carry out on both, you could build an array of the DAQmx Task wires, and pass that to a For loop, but usually I just place two sets of things to clarify intent. If you have lots of operations (Stop, Clear, check for specific errors, format a message saying a task ended etc) you could just use a subVI and place two copies of the subVI for example.


GCentral
Message 13 of 22
(599 Views)

I have just two DaqMx read, so I will use two clear tasks at the end.

Still, I had to merge errors, because otherwise it seems to me I had to duplicate all the previous code.

I think this solution is ok (I attach the code for reference in case, sub-vi RDI is just a Daqmx read plus some algebra).

Thanks for your support

0 Kudos
Message 14 of 22
(596 Views)

I'd suggest trying to straighten out some wires, but otherwise that looks fine to me 🙂


GCentral
Message 15 of 22
(589 Views)

Straighten out wires?

i assume it’s just an esthetic thing..

0 Kudos
Message 16 of 22
(588 Views)

Hi Davide,

 


@DavideB wrote:

I think this solution is ok.


Some more improvements:

check.png

  1. Replacing the ConcatString and several FormatString functions with a single FormatIntoString with a proper format string.
  2. Also note that "MISSING LABEL" at one of your controls: NEVER delete the label! (It's ok to hide it in the frontpanel.)
  3. You don't need to unbundle the Status of the error wire for an OR function…
  4. Right now you wire the error cluster through your FOR loop and also through the WriteFile function: when there is an error upstream you will not write data to your file! Maybe you need to change that error handling a little bit…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 17 of 22
(585 Views)

Thanks for your suggestions,

but if I unbundle the error I get an error, at least with my old version of Labview.

I understand from your previous post I should handle errors differently, but I dont know how..

 

 
 
 
0 Kudos
Message 18 of 22
(569 Views)

Hi Davide,

 


@DavideB wrote:

Thanks for your suggestions,

but if I unbundle the error I get an error, at least with my old version of Labview.

I understand from your previous post I should handle errors differently, but I dont know how..


Which LabVIEW version do you use?

 

On error handling:

When you want to save data to file even when one of your two DAQmx tasks gives an error then you should NOT wire that error cluster into the WriteFile function: when an error is present at error in it will not write any data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 22
(554 Views)

I use labview 2010

0 Kudos
Message 20 of 22
(540 Views)