LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What do you think about my simple code?


@GRCK5000 wrote:

This is a setup for two similar NI modules. The configuration is the same for both. The attached code is how I set up the code. It's fine to me, but I was thinking maybe it needs improvement. What would be your suggestion or how would you set it up? If you think  my code looks good, let me know. 

I'm trying to learn from others. 

Thank you.

 

P.S.: The output of Daqmx read is a 1D array of both modules

GRCK5000_0-1677599960020.png

 

 


Arrays are zero indexed. That means your attempt to split both modules starting at index 1 is actually swapping the second module into the shift register previously holding the first on the first while loop iteration and after the second iteration you have lost both. By the third iteration, both executions of the DAQ read should be generating errors, but you are not handling or displaying errors so there will be nothing to alert you to this aside from your results all being 0.

 

You are also continuously merging errors onto themselves.

 

You don't need to pass these individual elements into the loop at all. Build the array and merge the errors prior to the loop. You should only need one shift register each for the DAQ tasks and error cluster.

0 Kudos
Message 11 of 12
(199 Views)

@altenbach wrote:

@Yamaeda wrote:
 As already mentioned, after the measurement you only index out 1 element (the other will be empty) so after the 1st loop you'll only measure the 2nd task each time.

Well, after one more iteration, all tasks are lost forever.


Right! I somehow missed that at a quick glance!

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 12 of 12
(158 Views)