09-05-2017 03:06 PM
Dear friend,
In this question, https://forums.ni.com/t5/LabVIEW/A-simple-labview-question-with-example-vi-attached-Thank-you/td-p/3... . I learned that the way I was doing is impossible. Because the green wire to 2nd state machine will have value only 1st state machine stop!. But my goal is first state machine will running, then 2nd will start to run after the 1st one gives true (the green from 1st one). I do need to keep 1st state machines keep running. In others words, the both state machine will be running eventually.
I am doing this, because i am doing much bigger project, and there are 2 state machines. If this cannot be done in one VI, maybe make 2 independent VI, and somehow 1st VI will inform 2nd VI start to run? But I am not sure about it. Thank you.
09-05-2017
03:29 PM
- last edited on
10-19-2025
02:22 PM
by
Content Cleaner
Look at the queued message handler architecture. You can have the message handler (or consumer) loop run like a state machine, and allow the queue to interrupt it for things like start, shutdown, etc.
09-05-2017 03:37 PM
You can do so using a notifier.
09-05-2017 03:58 PM
@Gregory wrote:
You can do so using a notifier.
I've taken an irrational dislike to notifiers. It seems every time I've used one that half way through the project I've regretted it and switched to a queue.
And since I'm on the rant, I've taken an irrational hated of occurrences because they seem such a simple perfect solution at first... and then you have to add some functionality and they promptly produce spaghetti code.
09-05-2017 04:07 PM
hi, gregoryj.
You think queue is better? Because I am not familiar with both... lol
09-05-2017 04:16 PM
Yes, I often prefer a queue over a notifier, but there are two cases where I use notifiers.
Maybe it's just that the terminology of the notifier "wait on notification..." feels more natural than "dequeue element" when I want my code to be waiting on another process.
09-05-2017 04:29 PM
Sunson, they are very similar, and in your case I imagine they would be identical. Here are a couple of differences between the two that I think are worth noting:
09-05-2017 05:54 PM
Hi gregoryj.
Could you please help me edit my attached vi? My target is, the 1st one keep blinking, after true coming from 1st state machine. The 2nd one will start blink as well. BUT the 1st should NOT stop, but keep blinking as well. I do have to keep those 2 state machines. Thanks for your help in advance.
09-05-2017 06:09 PM
Sorry, I cannot open up LV 2017 files. Can you upload for previous version?
09-05-2017 06:12 PM
Hmm. I dont have lower version, but the vi is very very simple. Could you check the picture? For state machine, state 1, there are nothing (just state 1 then go to state 2). I only state "2" is doing the blinking thing. Thank you so much.