<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Priority button in a state machine in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230173#M1228362</link>
    <description>&lt;P&gt;Put the case structure with sequences inside the timeout event and add an event for the stop button. All other state can be handled with event cases.&lt;/P&gt;
&lt;P&gt;Keep the timeout in a shift register and manipulate the timeout from -1 to finite if sequences should execute.&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2022 16:36:03 GMT</pubDate>
    <dc:creator>altenbach</dc:creator>
    <dc:date>2022-05-12T16:36:03Z</dc:date>
    <item>
      <title>Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230168#M1228358</link>
      <description>&lt;P&gt;Hello guys . i am working with this state machine for a HMI&amp;nbsp; to communicate with a specific instrument .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1/ i want that if i press the "stop measurment button" at any time in any state of my prgramm, this button stops the instrument&amp;nbsp;instantaneously without having to wait that all the sequences are done ( beacuse once all the sequences are done, the instrument stops automatically) . Can i set a priority in labview states ???&amp;nbsp;&lt;/P&gt;
&lt;P&gt;( i didn't post all the program due to its confidentiality so i just wrote a descriptin in every state)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/ i want to calculate the execution time of every state&lt;/P&gt;
&lt;P&gt;pleaaase help&amp;nbsp; me !!!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 16:16:50 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230168#M1228358</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-12T16:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230173#M1228362</link>
      <description>&lt;P&gt;Put the case structure with sequences inside the timeout event and add an event for the stop button. All other state can be handled with event cases.&lt;/P&gt;
&lt;P&gt;Keep the timeout in a shift register and manipulate the timeout from -1 to finite if sequences should execute.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 16:36:03 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230173#M1228362</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2022-05-12T16:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230174#M1228363</link>
      <description>&lt;P&gt;can u do this in the vi that i attached bellow cuz i didnt understand you and thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 16:41:31 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230174#M1228363</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-12T16:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230175#M1228364</link>
      <description>&lt;P&gt;You need a queued message handler rather than a simple state machine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With a QMH the event loop is always running and a pripority command can be added to the state queue with Enqueue at opposite end.&lt;/P&gt;
&lt;P&gt;A brief mod is attached (incomplete)&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 16:42:47 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230175#M1228364</guid>
      <dc:creator>JÞB</dc:creator>
      <dc:date>2022-05-12T16:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230422#M1228442</link>
      <description>&lt;P&gt;i tried ur method but the problem that occured is that i want that once i clic on start measurment button it executes seq1 then seq2 then seq3 then seq4 and then the state machine returns to the state wait for event . In the code attached in the vi bellow once i clic on start measurement it go to the state sequence 1 and returns to the state wait for event whereas i want to execute seq1 until seq4 and return to the wait for event state .&amp;nbsp; Please can u have a look at the vi that i did ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 15:35:50 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230422#M1228442</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-13T15:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230425#M1228444</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/697189"&gt;@JASMIN185&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;can u do this in the vi that i attached bellow cuz i didnt understand you and thank you so much&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You did not attach your typedef. Also make sure to save for previous. Your latest attachment is in LabVIEW 2021, which many cannot open.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 15:55:53 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230425#M1228444</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2022-05-13T15:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230433#M1228446</link>
      <description>&lt;P&gt;here's the VI&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 16:16:48 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230433#M1228446</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-13T16:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230435#M1228447</link>
      <description>&lt;P&gt;Do you have the typedef of the original VI?&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 16:20:40 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230435#M1228447</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2022-05-13T16:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230540#M1228480</link>
      <description>&lt;P&gt;No, the vi came stripped of dependencies.&amp;nbsp; &amp;nbsp;Hence the really nasty split from the SSM to QSM&amp;lt;events&amp;gt; I assume the OP could&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.ni.com/t5/LabVIEW/Interrupt-a-an-unfinished-state-in-a-QSM/td-p/2817784#M825410" target="_self"&gt;GO TO GRAMMAS HOUSE as&lt;/A&gt; a better explanation of priority messaging but I failed to add that link&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple enqueue in a loop should give a nice sequence of "non-priority" steps.&amp;nbsp; The message handler would not need a wait for events case (the dequeue element automagically does that!)&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 12:43:20 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230540#M1228480</guid>
      <dc:creator>JÞB</dc:creator>
      <dc:date>2022-05-14T12:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230551#M1228486</link>
      <description>&lt;P&gt;I still think all we need is one simple loop as I suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course the term "immediately" is a bit soft when external instruments are involved, because the might need a clean shutdown procedure.&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 13:45:46 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230551#M1228486</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2022-05-14T13:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230553#M1228488</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I still think all we need is one simple loop as I suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Oh, certainly! I could be done that way.&amp;nbsp; Mixing a SSM with an Event loop manipulating timeout event works but.....&lt;/P&gt;
&lt;P&gt;It's a risk when the next developer that has to expand on it! Unless you like having them punch you in the nose when they meet you;)&amp;nbsp; a QMH is much easier to maintain.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 14:07:22 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230553#M1228488</guid>
      <dc:creator>JÞB</dc:creator>
      <dc:date>2022-05-14T14:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230575#M1228501</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you could use PCE Architecte for you project.&lt;/P&gt;
&lt;P&gt;you find below an Example.&lt;/P&gt;
&lt;P&gt;Best Regards.&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 16:40:50 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230575#M1228501</guid>
      <dc:creator>Emna20</dc:creator>
      <dc:date>2022-05-14T16:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230745#M1228595</link>
      <description>&lt;P&gt;yes but to make it easier for me i just uploaded the vi without the typdef .. we can consider a simple enum for the states&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 08:36:17 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230745#M1228595</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-16T08:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230750#M1228597</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When using enumerated types (enums), it is best practice to make a type definition .&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/creating_type_defs/" target="_blank" rel="noopener"&gt;Creating type definitions&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;prevents you from needing to rewrite the code each time you add or remove an item from an enum. This way, when you modify one of them, you don't get your string values replaced by numbers in the Case Structure labels.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;so , you should use the type definition for enum and reusable controls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 08:57:35 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230750#M1228597</guid>
      <dc:creator>Emna20</dc:creator>
      <dc:date>2022-05-16T08:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230751#M1228598</link>
      <description>&lt;P&gt;can u make&amp;nbsp; a simple vi for me to more explain what u want to say ??? and thank u&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 08:58:52 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230751#M1228598</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-16T08:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230758#M1228601</link>
      <description>&lt;P&gt;Hello emma i want once i clic on "start measurment " button the state machine execute seq1 then seq2 then seq3 then se4. i tried ur VI and when i clic on&amp;nbsp; "start measurment " button the state machine moves to the state "initialize" whitout executing sequences .&amp;nbsp; and i want that when i clic on stop button at any moment , i move imidiatly to the state "stop device" ie interupting the sequences that are executing . thank u&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 09:28:37 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230758#M1228601</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-16T09:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230764#M1228602</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the based items of enum ( &lt;STRONG&gt;Enum Constant&lt;/STRONG&gt; , &lt;STRONG&gt;Enum typedef&lt;/STRONG&gt; ) are : Initialize , Run , Close.&lt;/P&gt;
&lt;P&gt;after we add enum item : wait to (&lt;STRONG&gt;Enum Constant&lt;/STRONG&gt; , &lt;STRONG&gt;Enum Typedef&lt;/STRONG&gt; ),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=&amp;gt;&amp;nbsp;&lt;SPAN&gt;The top&amp;nbsp;Case Structure in&amp;nbsp;the image below shows numbers instead of string labels because one the enum constant has been modified in one of its values. Therefore, LabVIEW coerces all of the case labels to a numeric type and makes the Case Structure expect just numeric values. (to correct this you need to add the wait items in every enum constant in the case structure ).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=&amp;gt; on the other hand ,&amp;nbsp;The Bottom Case Structure in&amp;nbsp;the image below shows string labels because one the enum constant is a type definition Enum&amp;nbsp;prevents you from needing to rewrite the code each time you add or remove an item from an enum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emna20_1-1652692356236.png" style="width: 400px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/302947i5AE17090418162B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Emna20_1-1652692356236.png" alt="Emna20_1-1652692356236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 09:50:26 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230764#M1228602</guid>
      <dc:creator>Emna20</dc:creator>
      <dc:date>2022-05-16T09:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230779#M1228610</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You find attached an the VI.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 10:48:17 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230779#M1228610</guid>
      <dc:creator>Emna20</dc:creator>
      <dc:date>2022-05-16T10:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230865#M1228647</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/697189"&gt;@JASMIN185&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;yes but to make it easier for me i just uploaded the vi without the typdef .. we can consider a simple enum for the states&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, that's too much unnecessary work for us. You have many diagram constants of that Enum scattered all over the diagram, so disconnecting from the typedef would need to be done for every instance, and if I want to change the items of the enum, I would need to do identical changes in N different places. If I cannot focus on the fun stuff and need to do all that menial work first, I will just walk away. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is MUCH easier for you just to attach the typedef! 10 seconds!&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 15:16:08 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4230865#M1228647</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2022-05-16T15:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Priority button in a state machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4231089#M1228727</link>
      <description>&lt;P&gt;Hello emna&amp;nbsp; i tried the following scenario with your program :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i clic on start measurement the state machine moves to seq1 , seq2 , i press on stop button the state machine moves to the state "stop" but it returns to execute seq3 and seq4 . whereas i want once i clic on stop button the state machine interrupt the execution of the sequences and returns to a state of waiting for another user intrface action . u helped me so much and i would be thankful if we find a solution for this problem&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 10:10:23 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Priority-button-in-a-state-machine/m-p/4231089#M1228727</guid>
      <dc:creator>JASMIN185</dc:creator>
      <dc:date>2022-05-17T10:10:23Z</dc:date>
    </item>
  </channel>
</rss>

