04-17-2019 11:26 AM
In the interest of finding a solution:
What do you want to happen?
You have two buttons.
What should happen if A is pressed?
What should happen if B is pressed?
Do they both need to be pressed for something to happen?
Maybe if you can clearly describe what you want to happen, we can help. I'll go out on a limb and say it's DEFINITELY do-able.
04-17-2019 11:55 AM
Take a look at the JKI State Machine; download it from VIPM.
It has an event structure in it, along with a string based State Machine. My suggestion is keep your event structure BUT do the the processing outside of the event structure. Here using the JKI State Machine as an example:
So what I am trying to say, make you code more modular and do not do any processing in the event structure, always outside of it.
If you do not know about state machine look at the examples.
mcduff
04-17-2019 11:55 AM
My point was whether LV could implement an event that fires event handlers in reverse order which text base can. If so, then the problem solved. Initially, I did not plan for the dynamically register events, and I only use it for additional features for additional requirents/or modifications.
04-17-2019 12:05 PM - edited 04-17-2019 03:58 PM
As others have said, you are not understanding events or the principles of dataflow, so the problem is not with LabVIEW. You simply need to step back and stop digging. There are trivially simple solutions to your problem (and none involve signaling properties, sequences, or duplication of code!) and we will help you once you post some simplified code.
For example, the same event case can be assigned to both booleans and contain a case structure to skip some parts depending on the boolean states.
If the other event should operate in parallel, use a separate while loop and event structure.
04-17-2019 12:16 PM
@Autenbach
My initial question was the 'executipon order of events' NOT how to code an event. You are not understanding the question.
Anyway, I have a number of solutions on my own. I just want to show the weak/strong points of LV.
Thank you all
04-17-2019 12:24 PM
@John4191 wrote:
I just want to show the weak/strong points of LV.
Yes, this (i.e. dataflow paradigm) is one of the strongest points of LabVIEW, of course. Embrace it instead of trying to fight it. 😄
04-17-2019 02:28 PM - edited 04-17-2019 02:31 PM
@John4191 wrote:
@Autenbach
My initial question was the 'executipon order of events' NOT how to code an event. You are not understanding the question.
Anyway, I have a number of solutions on my own. I just want to show the weak/strong points of LV.
Thank you all
@John4191 - I'm not sure what your point is. Your code is doing exactly what you tell it to do. Events are executed in the order received. You asked for a solution to a problem but didn't really want a solution. You are using poor LabVIEW programming practice but want to bash the programming language instead of accepting the help given voluntarily. Doing what you said that you wanted to do is EASY in LabVIEW. Personally I would make this a QMH as I like to use my event structure to capture and fire events - not execute code.
04-17-2019 03:20 PM
@johntrich1971: Please read the whole thread of this topic again. I asked question about event execution order and from the discussion, it seems like LV have no capability to reverse the order of events like the text base does. As a result, I think it's a weakpoint of LV and that is not bashing. It seems like this forum is not helping but accusing for one's opinion about LV.
BTW, I am not approved for the SOLUTION but it marked anyway...
04-17-2019 03:37 PM
@John4191 wrote:
@johntrich1971: Please read the whole thread of this topic again. I asked question about event execution order and from the discussion, it seems like LV have no capability to reverse the order of events like the text base does. As a result, I think it's a weakpoint of LV and that is not bashing. It seems like this forum is not helping but accusing for one's opinion about LV.
BTW, I am not approved for the SOLUTION but it marked anyway...
Sorry you feel that way about the forum, it generally is really helpful. I think the accusations are a result of treating LabVIEW like a text language.
In your case example it seems like you want "goto" statements, go to this section and when finished return here. Data flow does not work like that. (In text programs you may be able to do that.)
In the code snippet you posted, the logic can be dangerous. For example you fire Event B, but before processing Event B you fire Event A. What happens to the program if it returns to the wrong place, the beginning of Event B, then you Fire another Event A, etc and end up in an infinite loop.
I am not a computer programmer, but I assume you want events to fire off in the order received. Each event then fires off States, functions, etc, typically not other events.
Think of a oscilloscope trigger. It waits for a threshold event then fires off a Start Data Acquisition State, not another event.
mcduff
04-17-2019 03:57 PM
Hi Mcduff,
Your words are reasonable and I totally agree about that. For instrument controls and automation, LV is #1 for a quick turn around solutions and no doubt about that. On top of this one LV also has a number of weakpoints like the "formula note" are still not working correctly, the logic of saving project and VIs is so uncommon.
Anyway, my solutions for this one are many. For example:
1) create another event which goes out the 'case' and fire the 'read' and 'write' event the order I wanted
2) add the 'read' code into the 'write event'
3) 'write' case (not in event anymore) and fire the 'read' event...
Thanks,'
J