Showing results for 
Search instead for 
Did you mean: 

Record Pressure using voltage as Reference

Hello All, 


I am working on a transducer and I am new to labview. I have struggled a lot with figuring out how to properly use labviews tools to create this program but this is what I have so far. The concept of this program is to use voltage a reference and when voltage changes from above 5V, it record one finite number and vice versa when voltage is less than 5V. I am using an optoisolator, so at pressure high, voltage should be 8V and at pressure low, voltage should be at 0V. I need to record 5 separate pressures for 5 different channels. I have created a truth case for each channel and used flags to create a chain of command. I am having issues actually recording the pressure correctly and maybe an issue with my flag set up and shift registers. Please let me know what I can do to correctly record the finite pressure. 


Thank you 

0 Kudos
Message 1 of 10

Hi gal,


@engineergal211 wrote:

Please let me know what I can do to correctly record the finite pressure. 

You need to create the correct algorithm (and VI) for your requirement.

As you didn't attach any code you will not get much more detailed help…

Best regards,

using LV2020 on Win8.1+cRIO
0 Kudos
Message 2 of 10

Here is the program

0 Kudos
Message 3 of 10

Hi gal,


please cleanup that VI before we start any further debugging!

There is so much Rube-Goldberg included…


Why do you need to use IndexArray twice to index the very same elements - right next to each other?

Why do you need to duplicate case structures 5 times to handle 5 array elements? Use an autoindexing loop to repeat a certain operation!

You don't need to wire constants at IndexArray to index elements starting from index 0…

Don't use BytesAtPort to read your serial port! Implement some error handling after reading the port…

What's the point of the sequence frame when reading the port?

What's the point of the outer FOR loop - especially when it is set to iterate just once!?

What's the point of shift registers when you don't use their data at the next iteration?

Why do you build an array of 5 elements based all on the very same single value??? Why do you need to evaluate that single value 5 times???

Much much more silly stuff…

Best regards,

using LV2020 on Win8.1+cRIO
Message 4 of 10



Thank you for your feedback, I tried to auto index but it did not seem to work. 

0 Kudos
Message 5 of 10

Sorry this is the updated version 

0 Kudos
Message 6 of 10

I haven't made any significant changes to the code, but here I attach a cleaned-up copy of your code with a number of comments describing what I did and why you might want to consider that in future.


Hopefully this might make it easier to see what's going on and reason about your logic (now slightly more readable).


I suspect the next step is to work out if the 10 Shift Registers can be replaced by one or two boolean array shift registers. That might simplify some of your handling, if they are intended to be individual values (e.g. switches?). This might also allow you to avoid the use of the For loops (I haven't considered this closely).

GCentralI'm attending the GLA Summit!
0 Kudos
Message 7 of 10



some more improvements on those FOR loops to create your indicator data:

No loop needed, and no case structure is hiding code in cases…

Best regards,

using LV2020 on Win8.1+cRIO
0 Kudos
Message 8 of 10

Thank you for your help! I was wondering if there was a way to only record pressure starting at the first set point. As of now it record 0 psi for Pressure Low, I want it to start recording pressure when it gets to 400 PSI. I was wondering how I would accomplish that. 

0 Kudos
Message 9 of 10

Also how would I be able to record those values. I need them to record at the exact point and store them in the array. 

0 Kudos
Message 10 of 10