<?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: Edge Detection Toggle State Machine in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181372#M1208994</link>
    <description>&lt;P&gt;Good call on the use of the built-in Boolean Crossing function.&amp;nbsp; Both more clear and more versatile than our raw code.&amp;nbsp; Same startup behavior too -- edge detection output always False on first call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Kevin P&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. ....although FWIW, its internal logic IS a version of my boolean "gymnastics" rather than &amp;gt; or &amp;lt;.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Sep 2021 18:49:44 GMT</pubDate>
    <dc:creator>Kevin_Price</dc:creator>
    <dc:date>2021-09-27T18:49:44Z</dc:date>
    <item>
      <title>Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181139#M1208901</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a larger design (not my own) that I'm attempting to modify. I am VERY new to Labview. I needed something that would toggle back and forth on a false to positive edge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used some edge detection logic that I've seen suggested in some other posts to try and do that inside a case statement that used what I think is a local variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Logically, it seems simple enough, but it also seems that at times either it does NOT toggle, or perhaps it toggles 2x (the result being the same). The input is from "inside" the larger project, so in a hardware sense, it would not seem to be asynchronous (to everything else in the project, so to speak) at least to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I will admit to NOT understanding race conditions in Labview, and maybe that is the issue here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've given up trying to use this approach, but I am still trying to use the edge detector for another purpose (being driven by the same signal) and am worried that since I don't understand why this occasionally had a problem, that my use of the edge detector is also doomed to fail on occasion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any explanation why this case statement toggle approach seems to fail, especially as it involves edge detection would be GREATLY appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, I'm doing this (for free - at least right now) for a company that can't afford to update from the 2009 version (maybe they're getting what they're paying for....)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks (just for reading this far).&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 00:44:24 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181139#M1208901</guid>
      <dc:creator>LV_Neophyte</dc:creator>
      <dc:date>2021-09-27T00:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181168#M1208909</link>
      <description>&lt;P&gt;Simple solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Attach your Vi instead of a picture (we cannot run a picture)&lt;/LI&gt;
&lt;LI&gt;Please explain the purpose of all controls. Is the Day/night state where you want to detect when it changes?&lt;/LI&gt;
&lt;LI&gt;What should the final result be? (count number of changes? Flash an LED?&lt;/LI&gt;
&lt;LI&gt;What's the purpose of the D_PP control?&lt;/LI&gt;
&lt;LI&gt;You should also decide on a reasonable loop rate. Spinning as fast as the computer allows (millions of times per second!) is not needed to detect a rarely changing control.&lt;/LI&gt;
&lt;LI&gt;Why is there even a case structure if both cases are nearly the same? Only what differs belongs inside. (Still, the logic makes no sense!)&lt;/LI&gt;
&lt;LI&gt;Even if you have a case structure, the feedback node should probably be outside.&lt;/LI&gt;
&lt;LI&gt;To see if two boolean differ, a simple "not equal" works equally well (no need to negate and AND).&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 07:14:03 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181168#M1208909</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-27T07:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181174#M1208912</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/684740"&gt;@LV_Neophyte&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I needed something that would toggle back and forth on a false to positive edge.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;I assume "toogle back and forth" means flash the indicator LED ON/OFF&lt;/LI&gt;
&lt;LI&gt;You can detect a F - T transition when the new state (T) is greater than the old state (F), e.g. as follows.&lt;/LI&gt;
&lt;LI&gt;Make sure you place a reasonable wait inside the loop, else the led flash is too short to see.&lt;/LI&gt;
&lt;/UL&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="altenbach_0-1632726505320.png" style="width: 999px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292617i7753A2653FED6176/image-size/large?v=v2&amp;amp;px=999" role="button" title="altenbach_0-1632726505320.png" alt="altenbach_0-1632726505320.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 07:31:43 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181174#M1208912</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-27T07:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181337#M1208971</link>
      <description>&lt;P&gt;To the OP: this is purely a preferred style thing.&amp;nbsp; One of the very few things I'm inclined to disagree with&amp;nbsp;&lt;EM&gt;altenbach&lt;/EM&gt; about is the use of "Greater than" for boolean comparisons.&amp;nbsp; While he finds it very intuitive, I definitely don't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your brain's wired more like mine than his, here's the same code using the style of boolean logic I prefer to use.&amp;nbsp; It's the node named "Compound Arithmetic" which has nice properties of expanding for multiple inputs and the ability to individually invert any of the terminals.&amp;nbsp; The little circle on the upper input terminal in the pic below means that input is being inverted.&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="Kevin_Price_1-1632761357283.png" style="width: 400px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292653i6B90D6B6396CED2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kevin_Price_1-1632761357283.png" alt="Kevin_Price_1-1632761357283.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic for seeing a F-&amp;gt;T transition then reads literally as: "prev value NOT True AND present value True", or more casually as "was False before and is True now".&amp;nbsp; That feels more intuitive to me.&amp;nbsp; YMMV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Kevin P&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 16:53:06 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181337#M1208971</guid>
      <dc:creator>Kevin_Price</dc:creator>
      <dc:date>2021-09-27T16:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181340#M1208974</link>
      <description>&lt;P&gt;Thank you for your reply. I'll attempt to address each of the items in your reply in the same order.&lt;/P&gt;
&lt;P&gt;1. I've attached the VI as requested. Please remember I'm stuck on version 2009.&lt;/P&gt;
&lt;P&gt;2. Yes, I want to detect the night to day transition (but NOT the day to night transition).&lt;/P&gt;
&lt;P&gt;3. &amp;amp; 4. I was attempting to use this (in effect D_PP - "Day Ping Pong") to select every other day, or even and odd days, if you like. It then when on to select the case in another case state.&lt;/P&gt;
&lt;P&gt;5. Not sure that I understand "reasonable loop rate". As you may have surmised, this transition only occurs once every 24 hours, and that's when I want to flip the state of D_PP. (Sorry if that doesn't address your concern.)&lt;/P&gt;
&lt;P&gt;6. So the case structure would have a NAND gate for the "True" case and an AND gate for the "False" case, with the feedback and inversion outside - OK I understand that, but I'm not sure how to accomplish the same thing without a case structure - sorry I guess I'm just not experienced enough....&lt;/P&gt;
&lt;P&gt;7. Do you mean that I should skip (what I think is) the local variable and wire an output of the case statement back around to the input?&lt;/P&gt;
&lt;P&gt;8. I think this suggestion would give me BOTH edges, and I only want ONE.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 17:11:29 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181340#M1208974</guid>
      <dc:creator>LV_Neophyte</dc:creator>
      <dc:date>2021-09-27T17:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181342#M1208975</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/11892"&gt;@Kevin_Price&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;To the OP: this is purely a preferred style thing.&amp;nbsp; One of the very few things I'm inclined to disagree with&amp;nbsp;&lt;EM&gt;altenbach&lt;/EM&gt; about is the use of "Greater than" for boolean comparisons.&amp;nbsp; While he finds it very intuitive, I definitely don't.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Once we agree that T &amp;gt; F, my version is, at least for me, easier to read than boolean gymnastics (I even use "not equal" instead of XOR, for example!). Using plain comparisons on booleans (=, !=, &amp;gt;, &amp;lt;) is simpler than fancy, partially inverted compound functions, or even "implies". &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I am sure the compiler reduces it to the same machine code anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;True, LabVIEW has some holes where it forgets that T&amp;gt;F. While we can sort boolean arrays just fine, &lt;A href="https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-boolean-arrays-as-input-for-quot-Array-Min-amp-Max-quot/idi-p/1034196" target="_blank" rel="noopener"&gt;we cannot use array Min&amp;amp;Max on them&lt;/A&gt;&amp;nbsp;to get the desired index (1D, 2D, etc.) even though we can guess what the result should be &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course we also have the &lt;A href="https://zone.ni.com/reference/en-XX/help/371361R-01/ptbypt/boolean_crossing_ptbypt/" target="_blank" rel="noopener"&gt;boolean crossing tool&lt;/A&gt;. No extra code needed. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&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="altenbach_0-1632762984577.png" style="width: 999px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292654i4A675F65ED5F24C4/image-size/large?v=v2&amp;amp;px=999" role="button" title="altenbach_0-1632762984577.png" alt="altenbach_0-1632762984577.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 17:17:35 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181342#M1208975</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-27T17:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181346#M1208976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/684740"&gt;@LV_Neophyte&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. I've attached the VI as requested. Please remember I'm stuck on version 2009.&lt;/P&gt;
&lt;P&gt;2. Yes, I want to detect the night to day transition (but NOT the day to night transition).&lt;/P&gt;
&lt;P&gt;3. &amp;amp; 4. I was attempting to use this (in effect D_PP - "Day Ping Pong") to select every other day, or even and odd days, if you like. It then when on to select the case in another case state.&lt;/P&gt;
&lt;P&gt;5. Not sure that I understand "reasonable loop rate". As you may have surmised, this transition only occurs once every 24 hours, and that's when I want to flip the state of D_PP. (Sorry if that doesn't address your concern.)&lt;/P&gt;
&lt;P&gt;6. So the case structure would have a NAND gate for the "True" case and an AND gate for the "False" case, with the feedback and inversion outside - OK I understand that, but I'm not sure how to accomplish the same thing without a case structure - sorry I guess I'm just not experienced enough....&lt;/P&gt;
&lt;P&gt;7. Do you mean that I should skip (what I think is) the local variable and wire an output of the case statement back around to the input?&lt;/P&gt;
&lt;P&gt;8. I think this suggestion would give me BOTH edges, and I only want ONE.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;Mine detects the T -&amp;gt; F transition. You need to define which boolean value corresponds to day vs night and adjust accordingly (e.g. replace the &amp;lt; with a &amp;gt;).&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Your loop is spinning many millions of time per second. It is sufficient to poll every fraction of a second for millions of times less CPU use! Your loop without wait will redline one of your CPU cores forever (&lt;A href="https://forums.ni.com/t5/BreakPoint/LabTOONS-The-secret-life-of-LabVIEW-objects/m-p/724366#M5642" target="_blank" rel="noopener"&gt;see also&lt;/A&gt;).&lt;/LI&gt;
&lt;LI&gt;Yes, you don't need any local variables.&lt;/LI&gt;
&lt;LI&gt;If the D_PP needs to get inverted from the Day/Night input, just make it an indicator and wire it to the control using a NOT. No other code needed. D_PP should never be a control, because it should not be operated by the user at run time.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Can you explain in detail what your desired states are?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Program start: D/N=?, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N =T, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N T-&amp;gt;F, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N F-&amp;gt;T, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N F, D_PP=?&lt;/LI&gt;
&lt;/OL&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;</description>
      <pubDate>Mon, 27 Sep 2021 17:41:40 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181346#M1208976</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-27T17:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181372#M1208994</link>
      <description>&lt;P&gt;Good call on the use of the built-in Boolean Crossing function.&amp;nbsp; Both more clear and more versatile than our raw code.&amp;nbsp; Same startup behavior too -- edge detection output always False on first call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Kevin P&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. ....although FWIW, its internal logic IS a version of my boolean "gymnastics" rather than &amp;gt; or &amp;lt;.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 18:49:44 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181372#M1208994</guid>
      <dc:creator>Kevin_Price</dc:creator>
      <dc:date>2021-09-27T18:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181655#M1209097</link>
      <description>&lt;P&gt;Sorry for the delay, NI put me in a 24 hr timeout for being a new user!&lt;/P&gt;
&lt;P&gt;In answer to altenbach's questions:&lt;/P&gt;
&lt;P&gt;Can you explain in detail what your desired states are?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Program start: D/N=?, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N =T, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N T-&amp;gt;F, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N F-&amp;gt;T, D_PP=?&lt;/LI&gt;
&lt;LI&gt;D/N F, D_PP=?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;1. Program start D/N - could be either, I can't control this; D_PP - I don't care, could be T or F&lt;/P&gt;
&lt;P&gt;2. D/N = T, D_PP = D_PP&lt;/P&gt;
&lt;P&gt;3. D/N T-&amp;gt;F, D_PP = D_PP&lt;/P&gt;
&lt;P&gt;4. D/N F-&amp;gt;T, D_PP becomes NOT D_PP (it toggles).&lt;/P&gt;
&lt;P&gt;5. D/N F, D_PP = D_PP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FWIW, I changed the scheme based on my (in retrospect) incorrect interpretation of altenbach's point #7 in the first response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I went from this (which fails to switch properly at times):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LV_Neophyte_0-1632841950877.png" style="width: 400px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292715i36ABD18C33537A9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LV_Neophyte_0-1632841950877.png" alt="LV_Neophyte_0-1632841950877.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To this (which seems to be more robust):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LV_Neophyte_1-1632842063308.png" style="width: 400px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292716i7D590F5FC849BA21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LV_Neophyte_1-1632842063308.png" alt="LV_Neophyte_1-1632842063308.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that LV added the feedback node when I wired the output back to the input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This leads me to believe that my original attempt caused a race condition whereby both the T and F cases were evaluated in the same loop iteration meaning that D_PP switched twice when it should have only switched once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the added feedback (delay), that's impossible, I think.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to everyone for their time and effort - I feel good about solving the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:19:49 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181655#M1209097</guid>
      <dc:creator>LV_Neophyte</dc:creator>
      <dc:date>2021-09-28T15:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181666#M1209104</link>
      <description>&lt;P&gt;Hi Neophyte,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I prefer this look:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.ni.com/ni/attachments/ni/170/1209104/1/check.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;Boolean logic/algebra was part of my apprenticeship, before I repeated the same stuff at the university…&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:43:06 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181666#M1209104</guid>
      <dc:creator>GerdW</dc:creator>
      <dc:date>2021-09-28T15:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181680#M1209108</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/16916"&gt;@GerdW&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Boolean logic/algebra was part of my apprenticeship, before I repeated the same stuff at the university…&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For those without all that background in logic, here's my alternative. Same difference &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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="altenbach_0-1632846547013.png" style="width: 999px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292720iDE1318B633807ABD/image-size/large?v=v2&amp;amp;px=999" role="button" title="altenbach_0-1632846547013.png" alt="altenbach_0-1632846547013.png" /&gt;&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;Or, if the loop is big due to lots of other code, you can avoid long wires by replacing the shift register with a feedback node.&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="altenbach_0-1632847935163.png" style="width: 999px;"&gt;&lt;img src="https://forums.ni.com/t5/image/serverpage/image-id/292723i1C682D370223BC4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="altenbach_0-1632847935163.png" alt="altenbach_0-1632847935163.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 16:52:25 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181680#M1209108</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-28T16:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181687#M1209110</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/684740"&gt;@LV_Neophyte&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that LV added the feedback node when I wired the output back to the input.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Nothing to do with race conditions, just caused by the fact that you created a dependency loop. Since the case structure cannot execute until all it's inputs have new data (dataflow!), but one of the inputs depend on an output of the case structure, you create a deadlock. LabVIEW has a questionable option enabled by default to auto-insert a feedback node to "solve" the problem. While the wires are now no longer broken, it typically results in very questionable code, making things even worse (see &lt;A href="https://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Auto-insert-Feedback-Nodes-in-cycles-quot-Option-Default/idi-p/1080363" target="_blank" rel="noopener"&gt;this idea&lt;/A&gt; and &lt;A href="https://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-08-31-2009/m-p/975489#M437333" target="_blank" rel="noopener"&gt;my comment here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About your code in general:&lt;/P&gt;
&lt;P&gt;No, you don't need three feedback nodes and a local variable. Go with one of our suggestions instead. Maybe there are even simpler solutions. Did you understand my comment about the need for a small wait? It is still missing one!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 16:46:32 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4181687#M1209110</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-28T16:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4182024#M1209222</link>
      <description>&lt;P&gt;Altenbach,&lt;/P&gt;
&lt;P&gt;Thank you for your feedback (pun intended).&lt;/P&gt;
&lt;P&gt;WRT the wait, everything that I've "submitted" has a while loop purely for testing, which I remove prior to compiling the larger project. Again, it's just piece in a small part of a large design - the only part I intend to modify. The larger design has a while loop, but I'm WAY too chicken to add a wait to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My "preferred" solution, did not use any local variables, so&amp;nbsp; I'm not sure I understand your last comment about not needing local variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WRT the feedback nodes - I understand your comments about not needing 3 nodes, but I was attempting to make the smallest change to see what actually helps. If I change EVERYTHING, then I really don't learn as much - i.e. change one thing at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, about feedback nodes, even if they come out of the case statement, I'd still need 2 right? One for the edge detect and one for the actual feedback of the case statement output, ignoring for the moment some other solution that doesn't involve feedback nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, about the feedback node on the output of the case statement. I'm not uncomfortable with it. My background is hardware design, which I started back when using gates (AND, NAND, OR, NOR, etc) was common (so it's not boolean gymnastics for me). To me, in this instance, the feedback node is akin to what happens with a flip-flop that will determine the "next state" after the next clock edge in a state machine. I've read at least some of the links you've provided (and others besides), and do NOT see any reason to avoid using it, other than perhaps personal preference. If you can point me to some objective evidence that it really is a poor choice, I'm all ears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WRT the feedback node in the edge detect, it would seem that ANY solution would require either the feedback node itself (or something VERY similar like the shift register) to perform that function. I'm talking about the crossing function, for example, which to me, is simply a higher level of integration than a delay and a few gates - which, again, I'm comfortable with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lastly, in the interim, I've been experimenting with the VI that this pin-pong toggle was a part of. I've found a solution that does NOT require a case statement. That means that I don't need the feedback node that LV added for me, so in a sense there should be a little less concern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BUT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am still using the feedback node for my edge detect, and the edge detect (when I had problems with the ping-pong toggle) MIGHT have been the source of my problem. I am no longer worried that it was the problem. Feel free to tell me that I am wrong, but please explain why.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 17:06:56 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4182024#M1209222</guid>
      <dc:creator>LV_Neophyte</dc:creator>
      <dc:date>2021-09-29T17:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Edge Detection Toggle State Machine</title>
      <link>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4182045#M1209230</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/684740"&gt;@LV_Neophyte&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My "preferred" solution, did not use any local variables, so&amp;nbsp; I'm not sure I understand your last comment about not needing local variables.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There was no way to tell from a picture, especially since we cannot see what's in the other case (earlier, you showed two pictures, one for each case and here was again another picture with a local right next to it). The less information we get, the more blanks we fill in and the more misinterpretations can occur. &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;Yes, you need two feedbacks (or shift registers), one for the change detection and one for the output state, unless you use the boolean crossing tool (not sure if that's available in LabVIEW 2009). You definitely don't need any case structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course a limited static "picture" view into some code extracted from a much larger application limits our capabilities to give detailed advice, but it seems you have things under control now. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; Good luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 18:02:57 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Edge-Detection-Toggle-State-Machine/m-p/4182045#M1209230</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2021-09-29T18:02:57Z</dc:date>
    </item>
  </channel>
</rss>

