<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Reading analog inputs / network variables.</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/63086dce59/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/63086dce59/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/63086dce59/</id><updated>2020-02-27T20:54:41.611000Z</updated><subtitle>Recent posts to Reading analog inputs / network variables.</subtitle><entry><title>Reading analog inputs / network variables.</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/63086dce59/?limit=25#c32a" rel="alternate"/><published>2020-02-27T20:54:41.611000Z</published><updated>2020-02-27T20:54:41.611000Z</updated><author><name>spfeif</name><uri>https://forge.codesys.com/u/spfeif/</uri></author><id>https://forge.codesys.coma5289dd7ca6c4e2f15611655eb51232901b855ad</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;What is the analog value? In other words do you have a switch connected to an analog input but you want to use as digital?&lt;/p&gt;
&lt;p&gt;Assuming the analog value requires no filtering and you have a 10bit analog = 1024 then &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;xstate&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="ss"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;With&lt;/span&gt; &lt;span class="nv"&gt;debounce&lt;/span&gt; &lt;span class="nv"&gt;added&lt;/span&gt; &lt;span class="nv"&gt;DebounceOn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TON&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;DebounceOn&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;IN&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;HWtemp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;512&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;, &lt;span class="nv"&gt;PT&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;T&lt;/span&gt;&lt;span class="sc"&gt;#20&lt;/span&gt;&lt;span class="nv"&gt;ms&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;If&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;DebounceOn&lt;/span&gt;.&lt;span class="nv"&gt;Q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nv"&gt;xstate&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="nv"&gt;end_if&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Your digital input is xstate. &lt;/p&gt;
&lt;p&gt;If it is a true analog input that varies sporadically then filter it.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Reading analog inputs / network variables.</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/63086dce59/?limit=25#45b6" rel="alternate"/><published>2020-02-27T20:54:40.216000Z</published><updated>2020-02-27T20:54:40.216000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.com5fcd78995f0949d01694473a58bc41f30400aa9a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi John,&lt;br/&gt;
can't answer all your questions, but I can give a hint ref the analogue input.&lt;/p&gt;
&lt;p&gt;Normally analogue inputs get a signal -10 .. +10 V or 0(4) .. 20 mA. This is digitized by an analogue to digital converter just behind the terminals. The conversion result can be read by the PLC.&lt;br/&gt;
Format of analogue signals at PLC depends on the used hardware. It may be of INT or of WORD type.&lt;/p&gt;
&lt;p&gt;To use an analogue signal in your PLC program, you have&lt;br/&gt;
1. to read the input signal, as described above. For that, you have to declare an input variable (e.g.  resp. . * is a placekeeper for the real address)&lt;br/&gt;
2. to convert the value into a physical meaning by a "scaling procedure".&lt;br/&gt;
&lt;a class="" href="http://www.geisler-controls.de" rel="nofollow"&gt;http://www.geisler-controls.de&lt;/a&gt;, which has  particularly for step 2. Unfortunately, documentation is in German, but maybe the code helps you to understand how to do the job.&lt;/p&gt;
&lt;p&gt;Can't tell anything about the 2nd question. Did not yet work with PLCs in a network .&lt;/p&gt;
&lt;p&gt;Have success&lt;br/&gt;
Rolf&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Reading analog inputs / network variables.</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/63086dce59/?limit=25#806c" rel="alternate"/><published>2020-02-27T20:54:36.296000Z</published><updated>2020-02-27T20:54:36.296000Z</updated><author><name>john</name><uri>https://forge.codesys.com/u/john/</uri></author><id>https://forge.codesys.combe1b129e48068588d0dd616a76c3cdd07a65de41</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;br/&gt;
I am a new user of the codesys, and i have 2 questions that i could not fint the answer for in the manual.&lt;/p&gt;
&lt;p&gt;1: How do i read a analog input and use it in my code?&lt;br/&gt;
    I have defined it in the input section and given it the variable name HWtemp.&lt;br/&gt;
    I just cant find anywhere to read it like a digital input switch.&lt;/p&gt;
&lt;p&gt;2: I will be using several PLC connected on a TCP/IP network.&lt;br/&gt;
    How can i read a global variable in one PLC from another PLC or HMI Display?&lt;/p&gt;
&lt;p&gt;I am using: &lt;br/&gt;
ABB AC500 PLC's&lt;br/&gt;
PS501 V. 2.1.0 (Control builder)&lt;br/&gt;
Codesys V 2.3.9.28 (LD programming)&lt;/p&gt;
&lt;p&gt;John Jensen&lt;br/&gt;
Rio de Janeiro&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>