LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute order of an event trigged by other event

Solved!
Go to solution

@mcduff: Well, try to create dynamic user event and it's still the same. See attached.

 

0 Kudos
Message 41 of 63
(1,242 Views)

It's hard to debug pictures, but it looks like you are still trying mix in value signaling events in the event queue.

 

Remember LabVIEW is a dataflow language which means your tx_d User Event has to complete before going on to the next step.

So this is what is happening in the LabVIEW world:

  1. Your tx_d event fires
  2. The Event Structure goes into tx_d event. (Data flows into this case)
  3. Read Event is added to the Event Queue.
  4. Cannot Exit the tx_d event because you have 3 frames left of your structure
  5. Some Code1 here executes
  6. Write Event is added to the Event Queue.
  7. Some Code2 here executes
  8. Data leaves the tx_d event
  9. Program keeps running

You may call it a weakness, others may call it a strength, in the end it doesn't matter because the way LabVIEW is setup you cannot jump between events like you can in a text language. (?? Don't know for sure since I rarely use them).

 

If you don't like the data flow analogy maybe a causality explanation would help.

Events need to go to completion before going to another state. (Events fire in the order received.)

So assume Event A fires, Event B cannot fire before A (even if you try to trigger Event B from Event A) why ... because that would mean Event B occurred before Event A.

 

Sorry that you are frustrated, but it may take a while if you are coming from a text based programming background to get used to the way things work in LabVIEW. They are just different, no better, no worse. (In my case it took awhile to get used to the LabVIEW way of doing things) The more you program in LabVIEW, the better you will become.

 

The forums are really useful and sorry your first experience on them may not be ideal, but there are a lot a titans, NI calls them knights, that responded to your question. They are great resource that have solved a lot my problems; and typically aren't cranky except if somebody disparages LabVIEW.  (Once they became a knight they took an oath to defend LabVIEW.)

 

I'll try to code something up to post that hopefully will give you some ideas, but you may have to wait until tomorrow.

 

mcduff

Message 42 of 63
(1,237 Views)

I made an example using the JKI State Machine. Let me know what version of LabVIEW you are using so I save it correctly, if you are interested.

The main idea I want to convey is what happens after a event, and that can be shown in the picture below:

Snap47.png

The Write File Button is pressed; then the program goes into the File: Read State, and then the File: Write State. The event here is not a processing node, but a trigger to execute a sequence.

 

mcduff

 

PS Titan Reference in case you are interested

Jacobson - Insider Titan; NI employee, spiller of secrets

RavensFan - General Purpose Titan; hobby leaving wine at Poe's grave site

Intaris - FPGA Titan; hobby refactoring FPGA code

altenbach - Efficiency titan; hobby reducing block diagrams to postage stamps

Kevin_Price - DAQmx Titan; hobby does an excellent Fozzie Bear impersonation

Ben - Action Engine Titan; hobby developing natural water springs

Message 43 of 63
(1,209 Views)

2017

 

0 Kudos
Message 44 of 63
(1,154 Views)

@John4191 wrote:

2017


Are you replying to any particular message? Impossible to tell!

0 Kudos
Message 45 of 63
(1,146 Views)

@altenbach wrote:

@John4191 wrote:

2017


Are you replying to any particular message? Impossible to tell!


@altenbach - my post with the JKI example

 

2016 example attached. Let me know if you have any questions. I have include the subVIs needed for the JKI State Machine; I highly recommend downloading it from VIPM so you have it on the palettes. If you are unsure how to do that please let me know or if you have any questions please let me know.

 

mcduff

 

 

0 Kudos
Message 46 of 63
(1,139 Views)

How would this JKI state machine control the execution order like the one I asked? I know you all said that the 'signalval' is a trigger BUT It's still executed after other code soon or later which is poor design. 

 

Your JKI is just another state machine with 'while', 'event' and 'case' loops using shift registers for tranfering values between states instead of the typedef like I did. Both are the same logic. Seems like LV is pretty weak for this execution order scenario

 

If there's a competitor, LV is not my choice... 🙂

 

 

0 Kudos
Message 47 of 63
(1,124 Views)

@John4191 wrote:

How would this JKI state machine control the execution order like the one I asked? I know you all said that the 'signalval' is a trigger BUT It's still executed after other code soon or later which is poor design. 

 

Your JKI is just another state machine with 'while', 'event' and 'case' loops using shift registers for tranfering values between states instead of the typedef like I did. Both are the same logic. Seems like LV is pretty weak for this execution order scenario

 

If there's a competitor, LV is not my choice... 🙂

 

 


There is no signal value property node in my example; the trigger is the event of the value changing.

 

Separating the trigger event from the subsequent process is extremely powerful in my opinion. For example, assume you hit the close window X in the corner. If you handle the trigger directly in the event it would be cumbersome to program. For example, you would have to see what other windows are open, what memory is being used, what references are open etc, all within the event. By decoupling the trigger from what you want to occur later makes for more modular and adaptable code.

 

If there's a competitor, LV is not my choice... 🙂

 

Python is pretty powerful, programmers like RUST, .NET, java, and Visual Basic also has its admirers. For opening and reading files you can use any of the languages. If you are going to use LabVIEW then you will need to learn its idiosyncrasies. Once you learn it can be pretty powerful in my opinion.

 

Good luck with whatever you decide.

mcduff

0 Kudos
Message 48 of 63
(1,118 Views)

When I came to Switzerland a long time ago I learned German.

 

What I didn't do:

Oh lord, I've "learned" the language but these idiots can't understand the most basic of sentences. It's like they're completely ignorant of what I'm trying to say.  What is this crap with verbs at the end of sentences. It should be clear what is meant irrespective of the positioning of a verb.  And why do we need noun gendering? Workaround: refer to everything in the plural form and the gender is always feminine.  Talk about overengineering... This is a poorly thought out design, the language is pretty weak for any kind of real-world conversation. English is clearly superior.

Message 49 of 63
(1,084 Views)

@John4191 wrote:

...

 

If there's a competitor, LV is not my choice... 🙂

 

 


I can help you with that!

 

HPVee  (see here) may be more to your liking since you seem to want to program in LV as if it is a text based language.

 

But if you are going to have to stick with LabVIEW YOU will have to change your mindset about how to program. So far your posts read either like a troll or as someone that has been given a power drill and are not happy with it's performance trying to sand a board.

 

Programming  Languages (environments) are tools that allow developers to translate their ideas into a form that can be executed by computers. As different tools are used in different ways, various languages require different techniques. If you do not want to learn how the data flow paradigm works, please tune to a different channel.

 

Please see what Dhijkstra had to say about programming here.

 

And quoting him from here;

 

"

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

"

 

And before you touch on the next point that is lacking in LabVIEW, no you can not see the "C source code" generated by LV because it simply does not exist.

 

I hope that helps,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 50 of 63
(1,062 Views)