<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/</id><updated>2024-11-21T10:06:12.212000Z</updated><subtitle>Recent posts to Bibliothek: floatingpointutils</subtitle><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#924a" rel="alternate"/><published>2024-11-21T10:06:12.212000Z</published><updated>2024-11-21T10:06:12.212000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.comcec8a6d58b427fe59c4252e5470975d107e22e71</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;@Strucc.c: thanks very mutch. Yes, I think that was the problem.&lt;/p&gt;
&lt;p&gt;I tried yesterday a similar function, i have found:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;IEEE32&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;REAL&lt;/span&gt;

&lt;span class="nt"&gt;FUNCTION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;IEEE32_TO_REAL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;REAL&lt;/span&gt;
&lt;span class="nt"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;DWORD&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;VAR&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;PTREAL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;POINTER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TO&lt;/span&gt;&lt;span class="w"&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;span class="nt"&gt;PTREAL&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;IEEE32_TO_REAL&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;PTREAL&lt;/span&gt;&lt;span class="o"&gt;^;&lt;/span&gt;
&lt;span class="nt"&gt;END_FUNCTION&lt;/span&gt;


&lt;span class="nt"&gt;REAL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;IEEE32&lt;/span&gt;

&lt;span class="nt"&gt;FUNCTION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;REAL_TO_IEEE32&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;DWORD&lt;/span&gt;
&lt;span class="nt"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;REAL&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;VAR&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;PTDWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;POINTER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;DWORD&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;PTDWORD&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;REAL_TO_IEEE32&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;PTDWORD&lt;/span&gt;&lt;span class="o"&gt;^;&lt;/span&gt;

&lt;span class="nt"&gt;END_FUNCTION&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And this works perfect.&lt;/p&gt;
&lt;p&gt;Now, the only thing that isn't clear is the libary "FloatingPointUtils, 3.5.17.0 (System)"... For me, the libary doesn't work.&lt;/p&gt;
&lt;p&gt;But the problem is now solved.&lt;/p&gt;
&lt;p&gt;Thanks a lot.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=250#cbcc" rel="alternate"/><published>2024-11-19T10:05:23.680000Z</published><updated>2024-11-19T10:05:23.680000Z</updated><author><name>Strucc.c</name><uri>https://forge.codesys.com/u/struccc/</uri></author><id>https://forge.codesys.com8a37ac10747fbf775bfe361ee8fc48bfbae52273</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The issue s the byte order typically in this case.  Can be especially problematic with floating point numbers - even more tricky if transferred with a word based protocol.&lt;/p&gt;
&lt;p&gt;It is a peasant way to try out the alternatives, dword order can be a-b-c-d, b-a-d-c, c-d-a-b, d-c-b-a where a is the most significant, d is the least significant byte. &lt;br/&gt;
So all you need is to swap the bytes in your dword, until you get the expected result. If you don't want to mess writing code for this, I'd recommend CAA_Memory library for that:&lt;/p&gt;
&lt;p&gt;MEM.ReverseBYTEsInDWORD and MEM.ReverseWORDsInDWORD functions would definitively do the trick.&lt;/p&gt;
&lt;p&gt;Otherwise, can do like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kr"&gt;VAR&lt;/span&gt;
    &lt;span class="n"&gt;dwIn&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="o"&gt;#&lt;/span&gt;&lt;span class="mi"&gt;11223344&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;dwOut&lt;/span&gt;   &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;DWORD&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rOut&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;REAL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;pIN&lt;/span&gt;     &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;POINTER&lt;/span&gt; &lt;span class="kr"&gt;TO&lt;/span&gt; &lt;span class="kt"&gt;BYTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;pOUT&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;POINTER&lt;/span&gt; &lt;span class="kr"&gt;TO&lt;/span&gt; &lt;span class="kt"&gt;BYTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;pIN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;dwIn&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;pOUt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;dwOut&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;pOUt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;rOut&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nv"&gt;pOut&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;pIN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;pOut&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;pIN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;pOut&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;pIN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;pOut&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;pIN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ugly, but does the job...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#b9ab" rel="alternate"/><published>2024-11-18T15:25:38.684000Z</published><updated>2024-11-18T15:25:38.684000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.come0a9473536e273110f7e8faae94d530ef50ddfa3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Was ich auch nicht verstehe ist, dass bei "HexStrToReal" nicht "(FUN)" dahinter steht... Wie kann ich diese Bib denn sonst benutzen?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#d2fb" rel="alternate"/><published>2024-11-18T15:19:07.028000Z</published><updated>2024-11-18T15:19:07.028000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.com7de6eeb2c827da92c7fb6b0792baf610cdfb337b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo Herr Schwellinger,&lt;/p&gt;
&lt;p&gt;können Sie mir bitte noch einen Tip geben, wie ich eine korrekte Umrechnung von Codesys herausbekommen...&lt;/p&gt;
&lt;p&gt;Es geht nach wie vor um die Geschichte mit der Konvertierung einer Gleitkommazahl (lesend mit CANopen bei einem Microprozessor) &lt;/p&gt;
&lt;p&gt;Aus dem Input (hex value): 0x402e45a2 &lt;br/&gt;
würde ich nach der Konvertierung die Zahl: 2.723 erwarten...&lt;/p&gt;
&lt;p&gt;=&amp;gt; Über ein Beispiel wäre ich dankbar...&lt;/p&gt;
&lt;p&gt;Ich hoffe sie können mir sagen, wie das funktioniert...&lt;/p&gt;
&lt;p&gt;Freundliche Grüße&lt;br/&gt;
Sebastian &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#5371" rel="alternate"/><published>2024-11-05T08:20:48.916000Z</published><updated>2024-11-05T08:20:48.916000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.com2bde0b50907199997b3db984eb63c3a96c187f0f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, ich wollte mal freundlich nachfragen, ob es eine Lösung zu dem Problem mit der Bib gibt...&lt;/p&gt;
&lt;p&gt;Vielleicht weiß ja jemand, was zu tun oder zu beachten ist.&lt;/p&gt;
&lt;p&gt;Oder kann mir jemand sagen, ob die Bib bei ihm verwendbar ist?!?&lt;/p&gt;
&lt;p&gt;Danke&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#e676" rel="alternate"/><published>2024-10-22T11:15:40.127000Z</published><updated>2024-10-22T11:15:40.127000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.com49becf379440edb9fa29984a1dd6c17ec5c9630b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;danke für deine Antwort. Ich habe nun einfach ein Projekt erstellt inklusive der Bib "FloatingPointUtils, 3.5.17.0 (System)"&lt;/p&gt;
&lt;p&gt;Beim Auswählen einer Funktion, z.B. HexStrToReal kommt die besagt Fehlermeldung...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#15ea" rel="alternate"/><published>2024-10-18T16:21:45.222000Z</published><updated>2024-10-18T16:21:45.222000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.come97e386de66f96ae804dc445e43e8143af9cb894</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;naja die compiled library hast du ja - du hast halt eine exception - und dann wirst du gefragt ob du das ganze Debuggen willst.&lt;br/&gt;
Die offene Bibliothek wirst du nicht bekommen - daher würde ich so vorgehen:&lt;br/&gt;
Dein Projekt hier mal anhängen so das man mal draufschauen was du genau aufrufst und wie.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#b3a3" rel="alternate"/><published>2024-10-18T11:52:26.960000Z</published><updated>2024-10-18T11:52:26.960000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.com6d0458ed915e0f610e7252d49efeebadc94ee108</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ich habe nun auch versucht durch die Installation von Codesys Version 3.5.17.0 an die Bib zu kommen... Leider auch ohne Erfolg...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Bibliothek: floatingpointutils</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/8ecf0f2ad9/?limit=25#14bb" rel="alternate"/><published>2024-10-17T15:16:18.411000Z</published><updated>2024-10-17T15:16:18.411000Z</updated><author><name>SebastianRaPi</name><uri>https://forge.codesys.com/u/sebastianrapi/</uri></author><id>https://forge.codesys.com2d4601bf5c643ac13c4a992a825308d8c3c865da</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo Zusammen,&lt;/p&gt;
&lt;p&gt;ich versuche die Bibliothek FloatingPointUtils.compiled-library-v3 zu benutzen. leider kommt dabei folgende Fehlermeldung:&lt;/p&gt;
&lt;p&gt;Kein Quellcode für dieses Objekt... (siehe Anhang)&lt;/p&gt;
&lt;p&gt;Wie kann ich diese Bib einbinden? Kann ich diese irgendwo herunterladen?&lt;/p&gt;
&lt;p&gt;Mein Ziel ist es ein DWORD (float) in ein REAL umzuwandeln. ICh hoffe, dass ich dies mit der Funktion HexStrToReal machen kann.&lt;/p&gt;
&lt;p&gt;So wie hier:&lt;br/&gt;
&lt;a href="https://gregstoll.com/~gregstoll/floattohex/" rel="nofollow"&gt;https://gregstoll.com/~gregstoll/floattohex/&lt;/a&gt;&lt;br/&gt;
convert to float...&lt;/p&gt;
&lt;p&gt;Oder gibt es bei Codesys einen anderen Weg?&lt;/p&gt;
&lt;p&gt;Grüße&lt;br/&gt;
Sebastian&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>