01-21-2014 12:49 PM
Hello everyone,
i am currently working on a pattern matching project using Labview.
i have two boolean controls in it , one is a SYSTEM START button and the other is a OTP GENERATOR button. The SYSTEM START button is used to run the template code and the other is used generate a random number with every click of the button. for that i have changed the mechanical action of the OTP GENERATOR Boolean control to SWITCH UNTIL RELEASED.
My issue is that i cannnot operate both the boolean controls at the same time . if my SYSTEM START button is on then the OTP GENERATOR Button take a long time to run which is not my requirement.
i have even tried using a Global variable but the problem persists
Please help me two operate both the boolean controls simultaneously
Regards
Jalashwa
01-21-2014 12:59 PM
01-21-2014 01:14 PM
As Gerd already mentioned, you need while loops. Run each independent code part in its own while loop and they will not interfere. Learn about design patterns, though and some other basic programming rules. Use a UI loop for user interaction and a consumer loop for parallel background tasks.
Also note that you could run your three sequence frames in parallel, better utilizing all available CPU cores. The sequence structure forces sequential operation, which is inefficient..You could also use a parallel FOR loop for the mathcin operations (assuming the image tools are reentrant)..
01-22-2014 12:58 PM
dear altenbach and gerd,
thanks a ton!!!!!
i was earlier using the run continously button to operate the vi.
i have made the correction in the vi as you suggested and it is now working fine. Replacing the sequence structure also seems to be a brilliant suggestion. i shall work on it.
I need one more favour, i want the vi stop working when i feed in value to the control x2. Further , i want the START LED to switch off as well.
i made some modifications in the vi .
Your ideas to improve the vi are welcome.
Thanks again
Regards
JALASHWA
01-22-2014 01:28 PM - edited 01-22-2014 01:29 PM
You code is still overly convoluted.
Upper loop:
Lower loop:
@Sindhurakshak wrote:
I need one more favour, i want the vi stop working when i feed in value to the control x2. Further , i want the START LED to switch off as well.
You cannot interrupt the VI while it is busy running a subVI (unless the subVI is designed for it). It will only react to the user next time the control is encountered. How long does each analysis take? You should still have a look at established desing patterns, such as state machines. Have a look at consumer/producer designs.
01-23-2014 04:38 AM
Mr Christian Altenbach,
i thank you from the bottom of my heart for your analysis of my vi. It is a great learning experience for me . i hope i can learn more from you in the days to come.
The suggestions you have prescribed need through analysis and some more digging into LabVIEW.
I request you to give some more time so that i can change the VI. I will post the updated VI soon .
I hope you will help me out if i fall into more trouble.
Thanks again
With Warm Regards
JALASHWA
01-24-2014 02:24 AM
altenbach,
as advised by you i am working on converting the sequence structure into parallel loops.
i did run the vi and i found out that it takes longer and most of the times the result is not accurate.
i have attached the vi . i will be delighted if you could have a look at it.
with warm regards
JALASHWA
01-24-2014 02:35 AM
PS: i have also tried it with a for loop but no luck with that with that as well
01-24-2014 12:43 PM - edited 01-24-2014 12:44 PM
As I said, I don't have IMAQ, so there might be issues with reentrancies. In what way are the results different?