<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Capture Power Off Interrupt</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/3e0823610e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/3e0823610e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/3e0823610e/</id><updated>2020-02-27T20:11:57.609000Z</updated><subtitle>Recent posts to Capture Power Off Interrupt</subtitle><entry><title>Capture Power Off Interrupt</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/3e0823610e/?limit=25#9e25" rel="alternate"/><published>2020-02-27T20:11:57.609000Z</published><updated>2020-02-27T20:11:57.609000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com07466885e3e9b24553f29481aa7c4a20d4acc32a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;is also a bit in the statuslist&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Capture Power Off Interrupt</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/3e0823610e/?limit=25#1eee" rel="alternate"/><published>2020-02-27T20:11:56.254000Z</published><updated>2020-02-27T20:11:56.254000Z</updated><author><name>ndzied1</name><uri>https://forge.codesys.com/u/ndzied1/</uri></author><id>https://forge.codesys.comdaa26077e96d33f490cd00d5af06942d1d302a61</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If I understand you correctly, you want to trap the event that power is lost to the device.&lt;/p&gt;
&lt;p&gt;In general, you do this with what most people call a "first scan" bit or marker.  The idea is that if you create a bit that is only true during the first scan, then it is only on right when the target is re-powered.  By definition, if the power just came on, it must have been off   &lt;/p&gt;
&lt;p&gt;Some targets will include a status bit or marker specifically for this reason but it is very easy to create one.  In ST you could do this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;VAR&lt;/span&gt;
&lt;span class="nv"&gt;xFirstSCan&lt;/span&gt; :&lt;span class="nv"&gt;BOOL&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;; (* Initialize to True for 1st Scan *)&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;xFirstSCan&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
   &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;Put&lt;/span&gt; &lt;span class="nv"&gt;Startup&lt;/span&gt; &lt;span class="nv"&gt;Code&lt;/span&gt; &lt;span class="nv"&gt;Here&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
   &lt;span class="nv"&gt;xFirstScan&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Capture Power Off Interrupt</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/3e0823610e/?limit=25#f7ea" rel="alternate"/><published>2020-02-27T20:11:52.527000Z</published><updated>2020-02-27T20:11:52.527000Z</updated><author><name>RajeshGandhi</name><uri>https://forge.codesys.com/u/rajeshgandhi/</uri></author><id>https://forge.codesys.comade2b17381419bbaf0ad0f9df6489c51cad5596f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello All,&lt;/p&gt;
&lt;p&gt;We are using CC Systems CCPXS target device, So could anyone have any idea that how we can capture the interrupt of power failure to the target device.&lt;/p&gt;
&lt;p&gt;Thanks and Regards,&lt;br/&gt;
Rajesh G&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>