<?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[LED ausschalten]]></title><description><![CDATA[<p>Hi, jemand muss mir weiter helfen, es geht um RS232.<br />
Da ich ein Anfänger bin, habe ich eine einfachste Schaltung gebastelt.<br />
Die Schaltung sieht so aus:</p>
<p>0 0 0 0 0<br />
0 0 0 0|<br />
| |<br />
| |<br />
---- -------<br />
| R | | LED |<br />
---- -------<br />
| |<br />
-------- (Die zeichnung stimmt nicht ganz, der strom kommt von RTS nach GND)<br />
In Visual C++ habe ich ein neues Projekt(MFC-Anwendungs-Assistent [exe] -&gt; Dialogbasierend) gestartet. Dann habe ich alles gelöscht(1 Test und 2 Buttons) und dafür habe ich ein CheckBox gestellt. In Eigenschaften von CheckBox bei Formate ist auf Drucktaste gesetzte. Eine Member-Variable habe ich auch gemacht (m_bCheck1). Und das ist der Code den ich erstellt hab:</p>
<p>void CComPortDlg::OnEinaus()<br />
{<br />
// TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen<br />
UpdateData(TRUE);</p>
<p>if (m_bCheck1 == TRUE)<br />
{</p>
<p>HANDLE hPort = CreateFile(TEXT(&quot;COM2&quot;),GENERIC_READ | GENERIC_WRITE,<br />
0,NULL,OPEN_EXISTING,0,NULL);<br />
EscapeCommFunction (hPort, SETRTS);</p>
<p>}<br />
else<br />
{</p>
<p>HANDLE hPort = CreateFile(TEXT(&quot;COM2&quot;),GENERIC_READ | GENERIC_WRITE,<br />
0,NULL,OPEN_EXISTING,0,NULL);<br />
EscapeCommFunction (hPort, CLRRTS);<br />
CloseHandle (hPort);</p>
<p>}</p>
<p>}</p>
<p>Und wenn ich das Programm starte, dann ist es alles noch in Ordnung, sogar wenn ich die LED einschalte leuchtet sie, wenn ich aber ausschalten will, dann leuchtet sie immer noch. Sie schaltet nur dann aus, wenn ich das Programm beende. Ich hoffe jemand hat mich verstanden und kann weiter helfen!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/45075/led-ausschalten</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 22:18:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/45075.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Aug 2003 16:49:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LED ausschalten on Wed, 06 Aug 2003 17:02:21 GMT]]></title><description><![CDATA[<p>Hi, jemand muss mir weiter helfen, es geht um RS232.<br />
Da ich ein Anfänger bin, habe ich eine einfachste Schaltung gebastelt.<br />
Die Schaltung sieht so aus:</p>
<p>0 0 0 0 0<br />
0 0 0 0|<br />
| |<br />
| |<br />
---- -------<br />
| R | | LED |<br />
---- -------<br />
| |<br />
-------- (Die zeichnung stimmt nicht ganz, der strom kommt von RTS nach GND)<br />
In Visual C++ habe ich ein neues Projekt(MFC-Anwendungs-Assistent [exe] -&gt; Dialogbasierend) gestartet. Dann habe ich alles gelöscht(1 Test und 2 Buttons) und dafür habe ich ein CheckBox gestellt. In Eigenschaften von CheckBox bei Formate ist auf Drucktaste gesetzte. Eine Member-Variable habe ich auch gemacht (m_bCheck1). Und das ist der Code den ich erstellt hab:</p>
<p>void CComPortDlg::OnEinaus()<br />
{<br />
// TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen<br />
UpdateData(TRUE);</p>
<p>if (m_bCheck1 == TRUE)<br />
{</p>
<p>HANDLE hPort = CreateFile(TEXT(&quot;COM2&quot;),GENERIC_READ | GENERIC_WRITE,<br />
0,NULL,OPEN_EXISTING,0,NULL);<br />
EscapeCommFunction (hPort, SETRTS);</p>
<p>}<br />
else<br />
{</p>
<p>HANDLE hPort = CreateFile(TEXT(&quot;COM2&quot;),GENERIC_READ | GENERIC_WRITE,<br />
0,NULL,OPEN_EXISTING,0,NULL);<br />
EscapeCommFunction (hPort, CLRRTS);<br />
CloseHandle (hPort);</p>
<p>}</p>
<p>}</p>
<p>Und wenn ich das Programm starte, dann ist es alles noch in Ordnung, sogar wenn ich die LED einschalte leuchtet sie, wenn ich aber ausschalten will, dann leuchtet sie immer noch. Sie schaltet nur dann aus, wenn ich das Programm beende. Ich hoffe jemand hat mich verstanden und kann weiter helfen!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/325750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/325750</guid><dc:creator><![CDATA[freecounter]]></dc:creator><pubDate>Wed, 06 Aug 2003 17:02:21 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Wed, 06 Aug 2003 17:36:55 GMT]]></title><description><![CDATA[<p>vielleicht liegt es daran, dass du den handle bei der TRUE if abfrage nicht beendest. Wenn du die LED dann wieder ausschalten willst, wird ein neues handle erstellt, aber das alte handle ist immer noch da und dann wird es wohl zu einem konflikt kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/325787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/325787</guid><dc:creator><![CDATA[Perner]]></dc:creator><pubDate>Wed, 06 Aug 2003 17:36:55 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Wed, 06 Aug 2003 17:47:11 GMT]]></title><description><![CDATA[<p>vielleicht kannst du mir sagen, wie den HANDLE beenden kann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/325798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/325798</guid><dc:creator><![CDATA[freecounter]]></dc:creator><pubDate>Wed, 06 Aug 2003 17:47:11 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Wed, 06 Aug 2003 20:08:24 GMT]]></title><description><![CDATA[<p>genauso wie nach dem else block:<br />
CloseHandle (hPort);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/325859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/325859</guid><dc:creator><![CDATA[Perner]]></dc:creator><pubDate>Wed, 06 Aug 2003 20:08:24 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Wed, 06 Aug 2003 20:18:30 GMT]]></title><description><![CDATA[<p>Ja, das ist das Problem, wenn ich das mache was du meinst, dann blickt die LED kurz auf und schaltet automatisch ab. Das habe ich als erstes versucht!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/325867</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/325867</guid><dc:creator><![CDATA[freecounter]]></dc:creator><pubDate>Wed, 06 Aug 2003 20:18:30 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Thu, 07 Aug 2003 09:36:01 GMT]]></title><description><![CDATA[<p>wenn Du mal reindebugs, wirst Du feststellen, daß Dein Handle beim false Zweig (da er ja neu deklariert wurde) wahrscheinlich 0 zurückgibt.<br />
Das passiert weil die COM Schnitti ja schon offen ist, und sie nicht zweimal geöffnet werden kann (so wie bei Files eben)<br />
Du solltest Dir das Handle merken und nur einmal öffnen und am Ende des Programms oder der Funktion schliessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/326142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/326142</guid><dc:creator><![CDATA[count.negative]]></dc:creator><pubDate>Thu, 07 Aug 2003 09:36:01 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Thu, 07 Aug 2003 11:15:10 GMT]]></title><description><![CDATA[<p>Kannst du mir auch verraten, wie ich das machen soll??<br />
Ich bin schon gestern darauf gekommen, aber ich weiß nicht, wie ich das machen soll!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/326248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/326248</guid><dc:creator><![CDATA[freecounter]]></dc:creator><pubDate>Thu, 07 Aug 2003 11:15:10 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Thu, 07 Aug 2003 11:39:03 GMT]]></title><description><![CDATA[<p>zum Beispiel könntest Du HANDLE hPort im Kopf deklarieren.<br />
Beim Öffnen des Dialogs (OnInitDialog()) kannst Du die Schnittestelle gleich öffnen:</p>
<p>hPort = CreateFile(TEXT(&quot;COM2&quot;),GENERIC_READ | GENERIC_WRITE,<br />
0,NULL,OPEN_EXISTING,0,NULL);</p>
<p>Beim schliessen des Dialogs machst Du sie dann wieder zu:</p>
<p>CloseHandle (hPort);</p>
<p>Dann bleibt Deine Logik auf<br />
EscapeCommFunction (hPort, SETRTS); und<br />
EscapeCommFunction (hPort, CLRRTS);</p>
<p>beschränkt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/326261</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/326261</guid><dc:creator><![CDATA[count.negative]]></dc:creator><pubDate>Thu, 07 Aug 2003 11:39:03 GMT</pubDate></item><item><title><![CDATA[Reply to LED ausschalten on Thu, 07 Aug 2003 13:41:10 GMT]]></title><description><![CDATA[<p>Eeeeeeeeeeeeeeeeeeee......... Geil, das funktioniert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/326353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/326353</guid><dc:creator><![CDATA[freecounter]]></dc:creator><pubDate>Thu, 07 Aug 2003 13:41:10 GMT</pubDate></item></channel></rss>