<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Pulse count counter</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/</id><updated>2020-05-10T10:37:03.202000Z</updated><subtitle>Recent posts to Pulse count counter</subtitle><entry><title>Pulse count counter</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/?limit=250#7f53" rel="alternate"/><published>2020-05-10T10:37:03.202000Z</published><updated>2020-05-10T10:37:03.202000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com6934a7a0cb3ad005c9d32a39e657c03615bd5eb9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You should check what &lt;strong&gt;type of sensor&lt;/strong&gt; you have and &lt;strong&gt;check/study the datasheet &lt;/strong&gt; of it.&lt;br/&gt;
You have to find out what the WORD represents. When you know this you can write some code to correctly read the information.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pulse count counter</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/?limit=25#80b9" rel="alternate"/><published>2020-05-10T09:46:00.347000Z</published><updated>2020-05-10T09:46:00.347000Z</updated><author><name>mawaloc</name><uri>https://forge.codesys.com/u/mawaloc/</uri></author><id>https://forge.codesys.com594e230adff2e4f02a73ed89d1dc46264ce886e1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Aliazz. &lt;br/&gt;
Thanks you for your comments&lt;/p&gt;
&lt;p&gt;Yes correct for that project I'm using Codesys 2.3.&lt;br/&gt;
About store the value =&amp;gt; "I'm" also Ok on this. My PLC Doesn't have "retain variable " But I know how to do.&lt;/p&gt;
&lt;p&gt;My problem is on the R-Trig function and after CTU function.&lt;br/&gt;
For those FUNCTION my understanding is you need "Boolean" Input to get the counting.&lt;br/&gt;
and here I don't have.  It's a "word type" , or at least I don't know How to catch them.&lt;/p&gt;
&lt;p&gt;I'm a beginner so may be I'm totally wrong but it's my understanding&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pulse count counter</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/?limit=250#bf48" rel="alternate"/><published>2020-05-10T08:33:09.507000Z</published><updated>2020-05-10T08:33:09.507000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com1c377436434da0884f65b477915709d20d3bba78</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Since we cannot see your code, apart from the snippet you have sent, we can only give you some hints and tips.&lt;br/&gt;
Plus it seems  to me you using a CODESYS v23 runtime?&lt;/p&gt;
&lt;p&gt;For;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;As&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="n"&gt;come&lt;/span&gt; &lt;span class="n"&gt;back&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;PLC&lt;/span&gt; &lt;span class="n"&gt;Power&lt;/span&gt; &lt;span class="k"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;restart&lt;/span&gt; &lt;span class="n"&gt;everytime&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You may try to store the counter in a VAR RETAIN (search extra help on how RETAIN works) however this dependent on your CPU.&lt;/p&gt;
&lt;p&gt;For;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;So&lt;/span&gt; &lt;span class="n"&gt;I&lt;/span&gt; &lt;span class="n"&gt;would&lt;/span&gt; &lt;span class="k"&gt;like&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;Rising&lt;/span&gt; &lt;span class="n"&gt;edge&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="k"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can use a R_TRIG (Standard.lib) Function Block. &lt;br/&gt;
You can accumulate the output count pulses of R_Trig (the .Q) value in a CTU (count up FB)&lt;br/&gt;
Search the help (standard.lib) for extra help on these FB's.&lt;/p&gt;
&lt;p&gt;I Hope these hints help you further,&lt;/p&gt;
&lt;p&gt;Aliazzz&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Pulse count counter</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/31e1c8349e/?limit=25#2524" rel="alternate"/><published>2020-05-10T06:59:35.327000Z</published><updated>2020-05-10T06:59:35.327000Z</updated><author><name>mawaloc</name><uri>https://forge.codesys.com/u/mawaloc/</uri></author><id>https://forge.codesys.com23445697826329f58a511595c544d18be20baa94</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;I'm trying to make a pulse count. &lt;br/&gt;
   In my system , I've a sensor that gave me a speed. =&amp;gt; ok for that&lt;br/&gt;
   MY PLC gave me also an input "pulse count". PI Sensor_Speedometer =&amp;gt; Value type Word.&lt;br/&gt;
   I'm trying from this Input to get a total distance.&lt;br/&gt;
     As this value come back to 0, when PLC Power off; it's restart everytime to 0.&lt;br/&gt;
   So I would like to make a counter on the Rising edge of this input, and record this value.&lt;/p&gt;
&lt;p&gt;How it's possible&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>