<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a64e872b4c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a64e872b4c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a64e872b4c/</id><updated>2020-02-27T19:55:32.634000Z</updated><subtitle>Recent posts to Read real values in a .txt files with SysFileRead: possible?</subtitle><entry><title>Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a64e872b4c/?limit=25#828b" rel="alternate"/><published>2020-02-27T19:55:32.634000Z</published><updated>2020-02-27T19:55:32.634000Z</updated><author><name>ilie.c.lucian</name><uri>https://forge.codesys.com/u/ilie-c-lucian/</uri></author><id>https://forge.codesys.comb0aba842afa901c2943bc04704b0ad617d7bac76</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You can also try this.&lt;br/&gt;
A real number has 32bits in Codesys. So you can try the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Read your real number, using SysFileRead, into a variable declared in the memory (eg. %MD8200), in double word (DWORD) format.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Declare a real variable at the same marker address (eg. %MD8200) and you have got your real number.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;BufferDWord AT %MD8200:DWORD;&lt;br/&gt;
BufferReal    AT %MD8200:REAL;&lt;/p&gt;
&lt;p&gt;BufferDWord=SysFileRead(...);&lt;br/&gt;
YourRealNumber=BufferReal;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Lucian&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a64e872b4c/?limit=25#5531" rel="alternate"/><published>2020-02-27T19:55:31.346000Z</published><updated>2020-02-27T19:55:31.346000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com1af0a773c6e048802041a23e81048ff3d0819988</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;the comma and the dot are language dependent, i would follow the english version, easier as you can not change the comma in a CDF.&lt;br/&gt;
have a look into the oscat library.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a64e872b4c/?limit=25#7555" rel="alternate"/><published>2020-02-27T19:55:27.712000Z</published><updated>2020-02-27T19:55:27.712000Z</updated><author><name>fredleemans</name><uri>https://forge.codesys.com/u/fredleemans/</uri></author><id>https://forge.codesys.com03438ee3af2851242b47d707e1e3d87f03b1b7b0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;In fact, the SysFileRead, take the byte value of every digit. For example in .csv file: the value to read is -0,013, first line. I will have finally in my "buffer": &lt;/p&gt;
&lt;p&gt;and then '$R' and '$N' for Return and New line. &lt;/p&gt;
&lt;p&gt;After I transform the byte in ascii with a IL_Byte_to_Ascii (something like that, I don't remember the right name). Present in Library of codesys.&lt;/p&gt;
&lt;p&gt;Then you use a CONCAT for several digit (used '$R' and '$N' to stop concat). In the end you have a string with the value '-0,013'. You can use now the conversion string_to_real in order to have the real value.&lt;/p&gt;
&lt;p&gt;PAY ATTENTION that with a ',' (comma) the conversion string_to_real will not work, you MUST have '.' (point).&lt;/p&gt;
&lt;p&gt;'-0.013' will give -0.013 in the real value.&lt;/p&gt;
&lt;p&gt;Until now I didn't find something faster to read a real in a . csv or .txt...&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a64e872b4c/?limit=25#4cfe" rel="alternate"/><published>2020-02-27T19:55:26.418000Z</published><updated>2020-02-27T19:55:26.418000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.come1142580d45daf11d8c1249c6b24a99902f3d423</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;what about STRING_TO_REAL&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Read real values in a .txt files with SysFileRead: possible?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a64e872b4c/?limit=25#3ae0" rel="alternate"/><published>2020-02-27T19:55:22.753000Z</published><updated>2020-02-27T19:55:22.753000Z</updated><author><name>fredleemans</name><uri>https://forge.codesys.com/u/fredleemans/</uri></author><id>https://forge.codesys.com23fff605b987c0ba108f0d0fe6b59c61c516cfcc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I try to read "Real values" from a .txt files (~5000 parameters), directly on the Flash card of my Rexroth PLC. I can open it with SysFileOpen and I can read value from it with SysFileRead but, i received information in Byte... So in place to have 20 different positions, I have data in Byte, so maybe an array of 100 bytes...&lt;/p&gt;
&lt;p&gt;Is it possible to read directly the different real positions and store it in a array of real?&lt;/p&gt;
&lt;p&gt;Thank you for your help,&lt;/p&gt;
&lt;p&gt;Bests regards,&lt;/p&gt;
&lt;p&gt;Fred&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: test.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=415"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>