<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/</id><updated>2020-02-27T15:48:21.284000Z</updated><subtitle>Recent posts to Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</subtitle><entry><title>Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/?limit=25#2254" rel="alternate"/><published>2020-02-27T15:48:21.284000Z</published><updated>2020-02-27T15:48:21.284000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com46fa22ceba0bdf7cba919a009a46147664435fc1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
for temprature reading this should never be a problem... what application do you have which need faster temp?&lt;br/&gt;
We just read then onewire via kernel modul which is providey by RaspberryPI.org&lt;br/&gt;
so each reading is like for example:&lt;br/&gt;
cat /sys/bus/w1/devices/10-000802cfb15d/w1_slave&lt;br/&gt;
If you so this manually via console with your sensors guess you will see these delays too.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/?limit=25#e369" rel="alternate"/><published>2020-02-27T15:48:18.902000Z</published><updated>2020-02-27T15:48:18.902000Z</updated><author><name>murmelish</name><uri>https://forge.codesys.com/u/murmelish/</uri></author><id>https://forge.codesys.com4d35590f68d08c80108df4392ad16c4eb50bad73</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Anyone, please?    &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/?limit=25#d177" rel="alternate"/><published>2020-02-27T15:48:18.051000Z</published><updated>2020-02-27T15:48:18.051000Z</updated><author><name>murmelish</name><uri>https://forge.codesys.com/u/murmelish/</uri></author><id>https://forge.codesys.comd528d437c6d7904b6369cc6423d6b1f93ed9a88e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;BUMP&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry Pi Codesys DS18B20 - 12s per reading (3 temp-sensors)</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/099171bbcf/?limit=25#3054" rel="alternate"/><published>2020-02-27T15:48:17.061000Z</published><updated>2020-02-27T15:48:17.061000Z</updated><author><name>murmelish</name><uri>https://forge.codesys.com/u/murmelish/</uri></author><id>https://forge.codesys.comf789e936c1c397d11eb9509a293bb08e0f776eaa</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello! Readings from my sensors are very slow. 12-16s per reading.&lt;/p&gt;
&lt;p&gt;I have three DS18B20-sensors wired to GPIO 4.&lt;/p&gt;
&lt;p&gt;I used the example program which came with Codesys - then built my program in there.&lt;/p&gt;
&lt;p&gt;I've read something about putting the onewire-stuff in another POU/task but I don't get it.&lt;/p&gt;
&lt;p&gt;What goes inside the onewire-task? This code?&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;PROGRAM&lt;/span&gt; &lt;span class="nt"&gt;PLC_PRG&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;astrID&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;..20&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;STRING&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ui&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;uINT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;rTemp&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;REAL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;NOT&lt;/span&gt; &lt;span class="nv"&gt;x&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
   &lt;span class="nv"&gt;x&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;;&lt;/span&gt;
   &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;scan&lt;/span&gt; &lt;span class="nv"&gt;function&lt;/span&gt;
   &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="nv"&gt;ui&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="nv"&gt;MIN&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Onewire_master&lt;/span&gt;.&lt;span class="nv"&gt;uiScannedDevices&lt;/span&gt;, &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt;
      &lt;span class="nv"&gt;astrID&lt;/span&gt;[&lt;span class="nv"&gt;ui&lt;/span&gt;] :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;Onewire_master&lt;/span&gt;.&lt;span class="nv"&gt;pasScannedDevices&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;[&lt;span class="nv"&gt;ui&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;].&lt;span class="nv"&gt;StringRepresentation&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;END_FOR&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I'm ok with 750ms delay per sensor but 12-16s is too much. I am using the temperaturs to control some relays. With only one sensor configured it works fine.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="http://i.imgur.com/RrqDzv1.jpg"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>