<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[4x 1 Byte in float.?]]></title><description><![CDATA[<p>HI Leute!</p>
<p>Ich möchte eine float Variable vom µC an den PC schicken! Über die RS232 schicke ich jeweils ein byte -&gt; also 4 x 1 byte ! Am PC erwartet ein Programm die Daten doch wie mache ich es das ich in eine Float die Werte richtig reinschreiben wenn 4x 1 byte kommt? also die bytes werden im µC nur immer um 8 stellen verschoben !</p>
<p>Ich hoffe es versteht jemand was ich meine <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>Frohe Weihnachten Leute :xmas1: und vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/95654/4x-1-byte-in-float</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 23:47:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/95654.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Dec 2004 07:16:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 4x 1 Byte in float.? on Wed, 22 Dec 2004 07:16:45 GMT]]></title><description><![CDATA[<p>HI Leute!</p>
<p>Ich möchte eine float Variable vom µC an den PC schicken! Über die RS232 schicke ich jeweils ein byte -&gt; also 4 x 1 byte ! Am PC erwartet ein Programm die Daten doch wie mache ich es das ich in eine Float die Werte richtig reinschreiben wenn 4x 1 byte kommt? also die bytes werden im µC nur immer um 8 stellen verschoben !</p>
<p>Ich hoffe es versteht jemand was ich meine <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>Frohe Weihnachten Leute :xmas1: und vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/678439</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/678439</guid><dc:creator><![CDATA[Schwarzi]]></dc:creator><pubDate>Wed, 22 Dec 2004 07:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to 4x 1 Byte in float.? on Wed, 22 Dec 2004 07:34:33 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>verwende doch einfach ein union dafuer<br />
zB so<br />
union unFS { char sStr[4]; float fWert; } unWandl;</p>
<p>in sStr schreibst du deine 4 Bytes rein in fWert steht dein float<br />
achten musst du auf den richtigen Reihenfolge der Bytes</p>
<p>MfG<br />
Klaus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/678448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/678448</guid><dc:creator><![CDATA[KlausB]]></dc:creator><pubDate>Wed, 22 Dec 2004 07:34:33 GMT</pubDate></item><item><title><![CDATA[Reply to 4x 1 Byte in float.? on Wed, 22 Dec 2004 12:10:09 GMT]]></title><description><![CDATA[<p>oder halt so:</p>
<pre><code class="language-cpp">float f1 = 123456.789f;

  // float in 4 char umwandeln
  char  c1 = ((char*) &amp;f1)[0];
  char  c2 = ((char*) &amp;f1)[1];
  char  c3 = ((char*) &amp;f1)[2];
  char  c4 = ((char*) &amp;f1)[3];

  float f2;

  // und umgekehrt
  ((char*) &amp;f2)[0] = c1;
  ((char*) &amp;f2)[1] = c2;
  ((char*) &amp;f2)[2] = c3;
  ((char*) &amp;f2)[3] = c4;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/678623</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/678623</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Wed, 22 Dec 2004 12:10:09 GMT</pubDate></item></channel></rss>