06-03-2022 10:50 AM
Hello,
I am semi new to using LabVIEW and have been handed down a VI and am stumped on how to incorporate a few things.
I have an indicator within a case structure within an event structure that I want to relay back to a control that precedes the structures upon command, some sort of button.
I.e. Push button, value in control becomes that of the indicator.
Secondly I have tab that runs a system and collects max points within a loop. I am attempting to collect that data in an array in a separate tab using an event structure. I have been able to transfer the data, but it only collects one data point overriding the previous point.
Thanks for any assistance.
Solved! Go to Solution.
06-03-2022 11:28 AM - edited 06-03-2022 11:31 AM
@Jwells93 wrote:
Hello,
I am semi new to using LabVIEW and have been handed down a VI and am stumped on how to incorporate a few things.
I have an indicator within a case structure within an event structure that I want to relay back to a control that precedes the structures upon command, some sort of button.
I.e. Push button, value in control becomes that of the indicator.
Secondly I have tab that runs a system and collects max points within a loop. I am attempting to collect that data in an array in a separate tab using an event structure. I have been able to transfer the data, but it only collects one data point overriding the previous point.
Thanks for any assistance.
Why is your program a State Machine jammed inside the time out case of an Event Driven State Machine?
This entire program should be rewritten as an Event Driven State Machine. Then it will be simple to add the indicator you want.
06-03-2022 11:33 AM
I do not know, it was built by a coworker and handed down to me when I came onboard.
I do not have the time or knowledge of LabVIEW to rewrite.
Is it possible to still add the indicators I am attempting.
Thanks
06-03-2022 12:39 PM - edited 06-03-2022 12:40 PM
I agree that this program is beyond help!
You have interactive loops inside event stuctures, inside case structures, inside another event structure, inside a loop. This needs to be tossed and started from scratch. Your coworker did really not do you any favors here.
(Also way too many unneeded local variables. The ms data in wrong representation (DBL instead of U32). etc. etc.)
Create a clean state machine. One outer loop. one case structure, max of 1 event structure. loop persistent data in shift registers. and so on.
06-03-2022 01:06 PM
Thank you all,
I appreciate the replies,
Again I am still fairly new to labVIEW, so more of a course of clarification.
I am removing the outer Event structure, is that enough to free up what I am needing to add, or is there stuff that is going over my head.
Thanks again,
06-03-2022 01:10 PM
@Jwells93 wrote:
I do not know, it was built by a coworker and handed down to me when I came onboard.
I do not have the time or knowledge of LabVIEW to rewrite.
Is it possible to still add the indicators I am attempting.
Thanks
Your coworker did not have the time or knowledge of LabVIEW to write the code in the first place. This code is total garbage. It's unclear exactly what you want to do - I guess that you could use another local variable. As bad as this program is what's another bad choice.
If this is code that you're going to have to be continuously responsible for my suggestion is to take the time to rewrite the program. Use a state machine or queued message handler (QMH - your coworker even referred to this in the comments). When done properly your code should easily fit on one computer screen. Stick with it enough and @altenbach can probably give you advice to get it to be the size of a postage stamp (OK, maybe not that small, but way smaller than it is now).
06-03-2022 01:31 PM
Thank you,
I know I am being a tad repetitive, I don't have the time to rewrite the code right now and have a deadline to add those fairly soon.
Is there any way to add the two things I'd wanted to with what I have.
I do plan on taking this on myself to a rewrite, but I don't believe I can rewrite everything within my time strait and limited knowledge.
Thanks again
06-03-2022 01:51 PM
@Jwells93 wrote:
Thank you,
I know I am being a tad repetitive, I don't have the time to rewrite the code right now and have a deadline to add those fairly soon.
Is there any way to add the two things I'd wanted to with what I have.
I do plan on taking this on myself to a rewrite, but I don't believe I can rewrite everything within my time strait and limited knowledge.
Thanks again
Well... In general, I would use a Shift Register to take a value output by one state and use it as in input in a later state.
Don't forget to wire the Shift Register through all of the cases.
06-03-2022 02:12 PM
Thank you,
I will go ahead and attempt that.
Is that suggested for both things I wanted to integrate or just the first configuration.
06-03-2022 03:44 PM - edited 06-03-2022 03:52 PM
@Jwells93 wrote:
Thank you,
I will go ahead and attempt that.
Is that suggested for both things I wanted to integrate or just the first configuration.
Just the first question... And my suggestion was very general, as I really don't have the energy to look at that code any further.
I know you are under the gun but sometimes we have to put our foot down and tell our managers no, like I had to do when I was told to add more features to this little beauty a predecessor left behind.