LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Either executing one Read function or the other, but not both

Hello All,

 

I'm having some trouble getting code to execute simultaneously. Attached is the VI. Essentially, the Read function towards the top of the code that returns a waveform, N samples and the Read function below it (1D DBL, 1 sample) will not read together. When I run the program, either one or the other returns values. For the waveform function, only the RPM will show up on the front panel and everything else will be 0, and for the 1D DBL function, PT-101 through FT-101 will show up and RPM will return an infinite value. Every time I run the code one of these two outputs happens seemingly at random. Any ideas on a potential fix?

0 Kudos
Message 1 of 4
(2,962 Views)

First simplify code using subvis.

-Understand the dataflow model of Labview

-To saveblock diagram space maybe uncheck the view as icon.

-it's quite difficult to see the code and see what's happening

 

Thanks
uday
0 Kudos
Message 2 of 4
(2,956 Views)

It is extremely difficult to comprehend a VI whose block diagram takes more than a dozen 1920x1080 screens to see.  In particular, it is hard to find the loops in question (to be honest, I didn't try very hard as moving around on the diagram was so disorienting).

 

Several suggestions:

  • Use Block Diagram Cleanup on sections of your code (I wouldn't try to do the whole thing all at once!)
  • Create sub-VIs to handle space-consuming-but-not-immediately-relevant sections of code (initialization comes to mind).
  • Avoid Sequence structures -- use Data Flow and the Error line to indicate sequencing.
  • Put Free Labels in your code (like "Look Here for the First Loop" and "Look Here for the Second Loop") [code that fits on a single screen, the Gold Standard for Block Diagram design, could make this less important ...].

Bob Schor

0 Kudos
Message 3 of 4
(2,948 Views)

Due use of DAQmx tasks we can not telll without poking at your copy of MAX. If the two different tasks are running on the same input module, you are probably running into the detail that only task can be active on the device at one time.

 

To correct combine the two competing taks into a sinlge task.

 

As to why one works and the toher does not randomly... The task that start the clock on the I/O card wins and the other task never starts correctly.

 

Put a probe or an indicator on the erro cluster wire, catch the error, then right-click the error code and choose show description. THe message should give you a clue.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(2,919 Views)