<?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[Problem mit COM Schnittstelle]]></title><description><![CDATA[<p>Ich programmiere ein Programm welches über die Com-Schnittstelle Daten von einer Wetterstation (von ELV - <a href="http://www.elv.de" rel="nofollow">www.elv.de</a>) empfängt.</p>
<p>Gesendet wird mit: 19200 Baud, 8 Bit, ungerade Parität und 2 Stopp-Bit<br />
Hier ist das Datenprotokoll: <a href="http://www.elv-downloads.de/service/manuals/PC-WS-Testempfaenger/39061-PC-WS-Testempfaenger.pdf" rel="nofollow">http://www.elv-downloads.de/service/manuals/PC-WS-Testempfaenger/39061-PC-WS-Testempfaenger.pdf</a></p>
<p><strong>Also habe ich erstmal den Port geöffnet ....</strong></p>
<pre><code class="language-cpp">DCB dcb;
hCom = CreateFile (&quot;Com1&quot;,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
dcb.DCBlength = sizeof (DCB);
GetCommState (hCom,&amp;dcb);
dcb.BaudRate=9600;
dcb.ByteSize=8;
dcb.Parity=NOPARITY;
dcb.StopBits=ONESTOPBIT;
SetCommState (hCom, &amp;dcb);

if (hCom == INVALID_HANDLE_VALUE) // hat es geklappt? Bei Fehler ist hier Schluss!
{
MessageBox (NULL, &quot;Fehler beim Öffnen des COM-Ports&quot;, NULL, NULL);

}
}
</code></pre>
<p><strong>.... dann die Read funkion ausgeführt ....</strong></p>
<pre><code class="language-cpp">unsigned char InString[COM_BUFFER_SIZE + 1];

DWORD dwRead = 0;
if(!ReadFile (hCom,&amp;InString,sizeof (InString),&amp;dwRead,NULL))Application-&gt;MessageBox(&quot;Fehler!!!!&quot;,&quot;&quot;,0);

if(dwRead != 0)
{
InString[dwRead]='\0';
}

Label1-&gt;Caption = reinterpret_cast&lt;char *&gt;(InString);
</code></pre>
<p><strong>Nun zum Problem:</strong><br />
Die Wetterstation schickt alle 3min neue Daten.<br />
Aber schon nach 10 sek bekomme ich eine Antwort von der COM.<br />
Und zwar sehr merkwürdige zeichen, zB ˜ï</p>
<p>Brauche dringend Hilfe! Danke!</p>
<p>gruß FB4</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/94293/problem-mit-com-schnittstelle</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 00:57:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/94293.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Dec 2004 18:27:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit COM Schnittstelle on Tue, 07 Dec 2004 18:27:14 GMT]]></title><description><![CDATA[<p>Ich programmiere ein Programm welches über die Com-Schnittstelle Daten von einer Wetterstation (von ELV - <a href="http://www.elv.de" rel="nofollow">www.elv.de</a>) empfängt.</p>
<p>Gesendet wird mit: 19200 Baud, 8 Bit, ungerade Parität und 2 Stopp-Bit<br />
Hier ist das Datenprotokoll: <a href="http://www.elv-downloads.de/service/manuals/PC-WS-Testempfaenger/39061-PC-WS-Testempfaenger.pdf" rel="nofollow">http://www.elv-downloads.de/service/manuals/PC-WS-Testempfaenger/39061-PC-WS-Testempfaenger.pdf</a></p>
<p><strong>Also habe ich erstmal den Port geöffnet ....</strong></p>
<pre><code class="language-cpp">DCB dcb;
hCom = CreateFile (&quot;Com1&quot;,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
dcb.DCBlength = sizeof (DCB);
GetCommState (hCom,&amp;dcb);
dcb.BaudRate=9600;
dcb.ByteSize=8;
dcb.Parity=NOPARITY;
dcb.StopBits=ONESTOPBIT;
SetCommState (hCom, &amp;dcb);

if (hCom == INVALID_HANDLE_VALUE) // hat es geklappt? Bei Fehler ist hier Schluss!
{
MessageBox (NULL, &quot;Fehler beim Öffnen des COM-Ports&quot;, NULL, NULL);

}
}
</code></pre>
<p><strong>.... dann die Read funkion ausgeführt ....</strong></p>
<pre><code class="language-cpp">unsigned char InString[COM_BUFFER_SIZE + 1];

DWORD dwRead = 0;
if(!ReadFile (hCom,&amp;InString,sizeof (InString),&amp;dwRead,NULL))Application-&gt;MessageBox(&quot;Fehler!!!!&quot;,&quot;&quot;,0);

if(dwRead != 0)
{
InString[dwRead]='\0';
}

Label1-&gt;Caption = reinterpret_cast&lt;char *&gt;(InString);
</code></pre>
<p><strong>Nun zum Problem:</strong><br />
Die Wetterstation schickt alle 3min neue Daten.<br />
Aber schon nach 10 sek bekomme ich eine Antwort von der COM.<br />
Und zwar sehr merkwürdige zeichen, zB ˜ï</p>
<p>Brauche dringend Hilfe! Danke!</p>
<p>gruß FB4</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668329</guid><dc:creator><![CDATA[ABC1234]]></dc:creator><pubDate>Tue, 07 Dec 2004 18:27:14 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit COM Schnittstelle on Tue, 07 Dec 2004 23:10:59 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/668492</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668492</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 07 Dec 2004 23:10:59 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit COM Schnittstelle on Wed, 08 Dec 2004 12:49:54 GMT]]></title><description><![CDATA[<blockquote>
<p>... Gesendet wird mit: 19200 Baud, 8 Bit, ungerade Parität und 2 Stopp-Bit ...</p>
</blockquote>
<blockquote>
<pre><code class="language-cpp">dcb.BaudRate=9600;
</code></pre>
</blockquote>
<blockquote>
<p>... ungerade Parität und 2 Stopp-Bit ...</p>
</blockquote>
<blockquote>
<pre><code class="language-cpp">dcb.Parity=NOPARITY;
dcb.StopBits=ONESTOPBIT;
</code></pre>
</blockquote>
<blockquote>
<p>Label1-&gt;Caption = reinterpret_cast&lt;char *&gt;(InString);</p>
</blockquote>
<p>Wo ist denn da das '\0' drin, um es als Text zu beenden? Und die empfangenen Zeichen (wenn denn welche kommen) sind alles Andere als ASCII-Zeichen.</p>
<p>Geht Dir da ein Licht auf?</p>
<p>Blackbird</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668707</guid><dc:creator><![CDATA[Blackbird]]></dc:creator><pubDate>Wed, 08 Dec 2004 12:49:54 GMT</pubDate></item></channel></rss>