07-01-2020 01:34 PM
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
07-01-2020 01:50 PM
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…
07-01-2020 02:53 PM
Here is the program
07-01-2020 03:02 PM - edited 07-01-2020 03:09 PM
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…
07-07-2020 12:38 PM
Hi,
Thank you for your feedback, I tried to auto index but it did not seem to work.
07-07-2020 12:45 PM
Sorry this is the updated version
07-07-2020 09:37 PM
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).
07-08-2020 12:32 AM - edited 07-08-2020 12:35 AM
07-09-2020 11:10 AM
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.
07-09-2020 11:11 AM
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.