<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Unexpected output from REAL_TO_STRING</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/77027e98d8/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/77027e98d8/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/77027e98d8/</id><updated>2020-02-27T14:16:41.625000Z</updated><subtitle>Recent posts to Unexpected output from REAL_TO_STRING</subtitle><entry><title>Unexpected output from REAL_TO_STRING</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/77027e98d8/?limit=25#64f6" rel="alternate"/><published>2020-02-27T14:16:41.625000Z</published><updated>2020-02-27T14:16:41.625000Z</updated><author><name>kmpm</name><uri>https://forge.codesys.com/u/kmpm/</uri></author><id>https://forge.codesys.comee8516437ff43f88cb12296bfc556a0136fd3c50</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm bumping this issue and also adding a request.&lt;br/&gt;
If you have some different Hardware could you please test the following.&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;rValue&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;sValue&lt;/span&gt;&lt;span class="o"&gt;:&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;bIsOk&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="nt"&gt;END_VAR&lt;/span&gt;
&lt;span class="nt"&gt;rValue&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;sValue&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;REAL_TO_STRING&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;rValue&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;bIsOk&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;sValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'0.2'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And then report back the make and model of the plc, perhaps runtime version if you know it and if you got TRUE in bIsOk or not.&lt;br/&gt;
The Berghof EC1000 returns FALSE because the string is '2.0e-1'.&lt;br/&gt;
CODESYS Control Win V3 returns TRUE.&lt;/p&gt;
&lt;p&gt;This would give me some hints on how common this issues is.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Unexpected output from REAL_TO_STRING</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/77027e98d8/?limit=25#cd78" rel="alternate"/><published>2020-02-27T14:16:41.204000Z</published><updated>2020-02-27T14:16:41.204000Z</updated><author><name>kmpm</name><uri>https://forge.codesys.com/u/kmpm/</uri></author><id>https://forge.codesys.com3e9923b3c03effeae656b7fde271760a87ac6661</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I am using REAL_TO_STRING to convert some decimal numbers to be transmitted as ascii over a serial connection.&lt;br/&gt;
Everything works fine unless the value to be converted is &amp;lt;1 and &amp;gt;-1.&lt;/p&gt;
&lt;p&gt;While using CODESYS Control Win V3 and CODESYS for Raspberry PI I get things like.&lt;br/&gt;
REAL = "STRING"&lt;br/&gt;
0.7 = "0.7"&lt;br/&gt;
-0.5 = "-0.5"&lt;/p&gt;
&lt;p&gt;But with a Berghof EC1000 I get the following&lt;br/&gt;
0.7 = "7.0e-1"&lt;br/&gt;
-0.5 = "-5.0e-1"&lt;/p&gt;
&lt;p&gt;This represents the correct values but was completely unexpected by the receiving end.&lt;br/&gt;
Bigger and equal to 1 and lower or equal to -1 works as expected.&lt;/p&gt;
&lt;p&gt;I am not able to find any documentation on how REAL_TO_STRING is supposed to work&lt;br/&gt;
and I'm now wondering if there is any standard for how this is supposed to be done?&lt;br/&gt;
If the implementation is allowed to differ then I will need to make my own function to deal&lt;br/&gt;
with it. I might have to do it anyway since I can't trust the implementation being consistent.&lt;/p&gt;
&lt;p&gt;Does anyone know how it's supposed to work and/or have similar experience from other vendor/hardware implementations?&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;br/&gt;
Peter&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>