05-03-2020 03:41 AM
Hi all
It's a status machine demo ,when I drop down "OK"button,program stuck and tick timer no respond and how to both run testing code and drop down menu set parameter,how to optimized to better.It's appreciated your prompt,thanks!!
05-03-2020 07:09 AM - edited 05-03-2020 07:10 AM
Your attached VI, unfortunately, had all of the Controls set to "stay invisible". You also managed to hide all of the Wires and functions on the Block Diagram that you attached. So without seeing (and being able to closely inspect, and ultimately run) your code, all we can say is "something is wrong with your code" (though, who knows, you might have a bad PC, or a bad installation of LabVIEW ...).
Why don't you try again by replying to this message and attaching your VI (or VIs) so we can see what you did?
Bob Schor
05-03-2020 08:19 AM
Thank you for replying,I want to make a test instruct with status machine instruct,when I scanning bar-code and focus return,start testing with custom instruct polling out and tick timer,in both drop down"Static->Set Parameter",will stuck it,how to optimized and try other way to best,thanks!
05-03-2020 08:26 AM
Before GerdW or others note that we Forum users always ask for WinZip for compression, here is the Original Poster's VI as a .zip file (I haven't even looked at it, yet ...).
Bob Schor
05-03-2020 09:35 AM
OK, I've now had a chance to look at the submitted code. There is one Control (whose name I don't know, as it appears to be named in Chinese, and seems to be an Enum consisting of something like a State Machine's "States", also in Chinese) that I renamed to "Control", and did a manual "Replace" in the Main VI and one sub-VI where it was used, which cleaned up all the Broken Arrows. But, of course, I don't know what the States mean, so am forced to "guess" What the Original Poster intended.
Some Forum readers of my Replies may have noticed I occasionally Rant and Rave about the distinction between What we want our LabVIEW code to accomplish and How we use the code to accomplish it. I'm sure that there's some good Computer Science terminology for this "What" vs "How" dichotomy, but I coined it when a colleague showed me a Block Diagram that spread across two large-ish monitors and said "Help me get this to run". I said "What does it do?", and he proceded to try to explain the Mess of Spaghetti before us. I said "No, don't tell me how it does it -- just in 2 sentences, tell me what you are trying to do ...". He said "Well I open some files, extract some data from each, and use these data to do such-and-such". OK, that might be 3 VIs: Open Files, Extract Data, Analyze Data. Our Humongous VI just became much smaller. Each sub-VI was (largely) independent, did a simple Task (for those into SOLID, this is the "S", "Single Responsibility"). Pretty soon, we had a dozen sub-VIs in place of one Mess, and the Problem in the code became obvious and easily solved.
So get out pencil and paper (or Keyboard and Browser to the Forum) and describe "what" you want to do. You seem to be using Menus as your "Organizing Principles". I remember encountering Menus in my first major LabVIEW project (already-developed code I was tasked with "improving" and "maintaining") that used Menus. I never understood the Menu system (and, more important, could not figure out "What" was being done, nor "Why"). I abandoned all the Menus and went to a structure similar to the Queued Message Handler, and the code (almost) re-wrote itself.
Bob Schor
05-03-2020 12:18 PM
@Bob_Schor wrote:
... always ask for WinZip for compression,
I don't think anybody asks for winzip. Winzip is commercial software that nobody needs. Any newer windows version has "compressed folders" built in. Just select all your files and folders, then "right-click...send to ...compressed (zipped) folder".
And if you need additional functionality, such a rar support and more, the free and open source 7zip is a great choice. Not sure why anyone would pay $30+ for winzip to clutter their computer with it. 😉
05-03-2020 12:46 PM
You are making some glaring beginner mistakes, such as placing lengthy loops inside event cases. Your event locks the front panel until it completes, that means once OK is pressed, the VI becomes unresponsive until that event is done. This entire thing is inside out. You might use the outer loop to anchor your state machine (e.g. using the timeout case) or you could place it in a separate loop, retaining the loop with the event structure for UI handling.
Some other problems:
Since I don't understand the rest of your code, I won't look further but I recommend to do a few tutorials and look at examples.
05-03-2020 07:13 PM
Thanks a lot.I have changed to English version ,product testing require as below:
1)when scanning bar code starting run and tick count on.
2)drop-down"static->set parameter"change upper or lower limited in both run test item.
in other words,when run the test item and tick count on,in both drop down menu change parameter will not stuck.
05-03-2020 09:13 PM - edited 05-03-2020 09:17 PM
It is still a total mess: Your event still has a lengthy loop inside an event frame.
05-03-2020 10:10 PM
I think that is mess in indeed,I desired to that function as mention,how to optimized it with present struct,thanks.