LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial and DAQ reading and writing issues

Hello NI community,

 

I am having difficulty consistently reading a Sensiron Flow Meter through a VISA while also reading a voltage through a DAQ. I found the VISA VI's from a different thread (http://forums.ni.com/t5/LabVIEW/Looking-for-sensiron-liquid-flow-meter-VI/td-p/1600392) and have attached all the VI's I am using (There are multiple so see replies).

 

My issues is that I will sometime get the main VI (Flow Base_12-11-02) to work, but other time it will not always read from the VISA displaying an error with either the VI startSampleSensirion.vi or initialize.vi When this error occurs it seems like the output of the data file is faster than when the program is working normally.

 

I have obtained data from the .txt file when the program works as intended but that amount of data is inconsistent to the sampling rate. I am a novice with LabView and was working off of the mostly working VI from the other thread mentioned above. 

 

The intent of the program is to read the value from the VISA and once the value has reached below 50% of the initial value to stop the program and do a calculation from the values coming from the DAQ. The formula wasn't developed due to the issues with the current design.

 

Thank you for your assistance

 

Alex

0 Kudos
Message 1 of 6
(2,314 Views)

More Vi's part 1

Download All
0 Kudos
Message 2 of 6
(2,312 Views)

More Vi's part 2

 

And an image of block diagram

0 Kudos
Message 3 of 6
(2,311 Views)

Alex,

 

I have not downloaded all of your VIs but I looked at the block diagram (BD) image.  You can zip all of the VIs and attach just one file in the future.

 

With all those local variables you probably have serious race conditions. LabVIEW is a dataflow language and local variables break the dataflow.  For example the locals at the bottom of the loop (which you mysteriously convert to a matrix, when a 2D array is all that is needed) are most likely read before the locals above are written. So the data will be one iteration behind, or maybe not. Although unlikley, it is theoretically possible that the locals might be read before the Initialize Array funcitons complete.

 

Learn to use shift registers. None of your locals are required.

 

It is also recommended to use Build Path rather than the String to Path conversion. It does some internal checking which may help avoid problems, especailly if you ever do any cross-platform work.

 

The Comparisons palette has a Less Than or Equal primitive which directly produces a boolean output and takes several hectares fewer of BD space.

 

Lynn

0 Kudos
Message 4 of 6
(2,286 Views)

Here is the the zip file with all the VI's.

 

Sorry for the inconvenience.

 

Alex

0 Kudos
Message 5 of 6
(2,258 Views)

You might also want to look into Autoindexing Tunnels for your building of arrays.  That would eliminate the need for almost all of your Insert Into Array and therefore almost all of your local variables.  The other few could be done with a shift register.


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 6 of 6
(2,254 Views)