02-07-2024 09:37 AM
Hi Friendly Smart Labview Community,
I'm student of Engineering and I try to make interface for my assigments but I have gotten a problem with LabView. With my case, I already write code to receive string from labview and control led. But I saw that the respone time too low and i cant send string in case 3. Any one can explain and give me some advices. Thank you so much.
Solved! Go to Solution.
02-07-2024 10:04 AM - edited 02-07-2024 10:05 AM
You have three booleans, meaning you can have 8 possible cases, but you only deal with four. (default,1,2,3)
For example if only combine=true, the value would be 4, triggering the default case.
If only one switch should be true at any given time, use a radiobutton control instead.
02-07-2024 10:17 AM
Good evening, sir!
I already change to use Enum control and its right.
Thank you so much for your help. Have a nice week, sir.
02-07-2024 10:23 AM - edited 02-07-2024 10:27 AM
Here's how you might want to do it. Only two cases and eliminate all that duplicate code.
You should probably put the VISA write in the default case. Makes little sense to write empty strings.
Note that in your case the selector value is the same as the first numeric output, so this would be equivalent. My solution above is more general, of course because you have flexibility about the values for each state, the array values can be chosen freely!.
02-07-2024 10:33 AM
Thank you sir so much. I'm going to take more time to think your idea and revise suitable with my requirement.
Thank you sir so much again.
02-08-2024 08:14 PM - edited 02-08-2024 08:33 PM
Good morning Sir.
I'm understand your idea and I already did it well.
But It occured new problem. I try to replace value in that position but I couldn't see the method to do it. Value in Flat Sequence will be continously send in 5s. Then change value and will be continously send in 5s or 6s....
The picture below is my idea.
Do you mind if you can give me some advices
02-09-2024 08:49 AM
Your code makes no sense in terms of dataflow. You cannot wire three different sources to the same input, of course. Also 15 seconds to complete a case is way too long. Why is there an indicator inside the case structure?
What you need is a simple state machine that spins the loop at a reasonable rate and switches state and output data as a function of selection, time, and user input.
Can you explain the functionality in more detail? Should the selector reset after one operation or continue forever until a different mode is selected? Should the "combine" case really go 1, 2, 1, 1, 2, 1, 1, 2, 1, ... with 5 seconds between or should it do a single 1, 2, 1, cycle? Why is the visa write not inside a case? It seems pointless to write an empty string 10x per second when nothing is selected. Does the instrument really need that?
Also you have again all that duplicate code. For example you really only need a single instance of that format string, right? At this point, remove the instrument input and just use a string indicator until all the logic is worked out.