<?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[zugriff auf die serial port, handshake]]></title><description><![CDATA[<p>hi,</p>
<p>wie greif ich auf den serial port zu um die (handshake)eingänge abzufragen?<br />
bitte nciht auf die faq verweisen, da war ich schon.<br />
bis jetzt hab ichs mit vreatefile versucht aber das funktioniert nicht richtig.<br />
könnte mir mal jemand ein stückchen code liefern? ich mach<br />
scheinbar alles falsch.:</p>
<pre><code class="language-cpp">//------------------------
int com_port::port_open(PORT_TYPE port)
{
	if (port != COM1 &amp;&amp; port != COM2)
		return ER_UNKNOWN_PORT;

	if (mOpen || mHandle != NULL)
		return ER_IS_OPEN;

	mHandle = NULL;

	mHandle = CreateFile(port==COM1?&quot;COM1&quot;:&quot;COM2&quot;, GENERIC_READ | GENERIC_WRITE,
							0, NULL,
							OPEN_EXISTING,
							0,
							NULL);
	if (mHandle == NULL)
	{
		mHandle = NULL;
		mOpen = false;
		return ER_OPEN_FAILED;
	}

	COMMTIMEOUTS ctm;

    ctm.ReadIntervalTimeout=20; 
    ctm.ReadTotalTimeoutMultiplier=0; 
    ctm.ReadTotalTimeoutConstant=1000; 
    ctm.WriteTotalTimeoutMultiplier=0; 
    ctm.WriteTotalTimeoutConstant=10; 

	SetCommTimeouts(mHandle, &amp;ctm);

	DCB temp;
	ZeroMemory(&amp;temp, sizeof(temp));
	GetCommState(mHandle, &amp;temp);

	temp.BaudRate = CBR_9600;
	SetCommState(mHandle, &amp;temp);

	SetCommMask (mHandle, EV_RXCHAR); 

	PurgeComm(mHandle, PURGE_TXCLEAR | PURGE_RXCLEAR);     

	DCB dcb;
	dcb.BaudRate    = CBR_9600;  
	dcb.ByteSize    = 4;    
	dcb.Parity      = 0;   
	dcb.StopBits    = ONESTOPBIT;  
	dcb.fDtrControl = DTR_CONTROL_HANDSHAKE; 
	dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
	dcb.fInX        = FALSE;   
	SetCommState(mHandle, &amp;dcb);

	mOpen = true;
	mPort = port;
	return ER_OK;
}
</code></pre>
<p>es wär echt wichtig.</p>
<p>danke-</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/64154/zugriff-auf-die-serial-port-handshake</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 08:42:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/64154.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 08 Feb 2004 15:50:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to zugriff auf die serial port, handshake on Sun, 08 Feb 2004 15:50:40 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>wie greif ich auf den serial port zu um die (handshake)eingänge abzufragen?<br />
bitte nciht auf die faq verweisen, da war ich schon.<br />
bis jetzt hab ichs mit vreatefile versucht aber das funktioniert nicht richtig.<br />
könnte mir mal jemand ein stückchen code liefern? ich mach<br />
scheinbar alles falsch.:</p>
<pre><code class="language-cpp">//------------------------
int com_port::port_open(PORT_TYPE port)
{
	if (port != COM1 &amp;&amp; port != COM2)
		return ER_UNKNOWN_PORT;

	if (mOpen || mHandle != NULL)
		return ER_IS_OPEN;

	mHandle = NULL;

	mHandle = CreateFile(port==COM1?&quot;COM1&quot;:&quot;COM2&quot;, GENERIC_READ | GENERIC_WRITE,
							0, NULL,
							OPEN_EXISTING,
							0,
							NULL);
	if (mHandle == NULL)
	{
		mHandle = NULL;
		mOpen = false;
		return ER_OPEN_FAILED;
	}

	COMMTIMEOUTS ctm;

    ctm.ReadIntervalTimeout=20; 
    ctm.ReadTotalTimeoutMultiplier=0; 
    ctm.ReadTotalTimeoutConstant=1000; 
    ctm.WriteTotalTimeoutMultiplier=0; 
    ctm.WriteTotalTimeoutConstant=10; 

	SetCommTimeouts(mHandle, &amp;ctm);

	DCB temp;
	ZeroMemory(&amp;temp, sizeof(temp));
	GetCommState(mHandle, &amp;temp);

	temp.BaudRate = CBR_9600;
	SetCommState(mHandle, &amp;temp);

	SetCommMask (mHandle, EV_RXCHAR); 

	PurgeComm(mHandle, PURGE_TXCLEAR | PURGE_RXCLEAR);     

	DCB dcb;
	dcb.BaudRate    = CBR_9600;  
	dcb.ByteSize    = 4;    
	dcb.Parity      = 0;   
	dcb.StopBits    = ONESTOPBIT;  
	dcb.fDtrControl = DTR_CONTROL_HANDSHAKE; 
	dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
	dcb.fInX        = FALSE;   
	SetCommState(mHandle, &amp;dcb);

	mOpen = true;
	mPort = port;
	return ER_OK;
}
</code></pre>
<p>es wär echt wichtig.</p>
<p>danke-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/454513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/454513</guid><dc:creator><![CDATA[_um]]></dc:creator><pubDate>Sun, 08 Feb 2004 15:50:40 GMT</pubDate></item><item><title><![CDATA[Reply to zugriff auf die serial port, handshake on Sun, 08 Feb 2004 15:59:48 GMT]]></title><description><![CDATA[<p>Setzen: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/escapecommfunction.asp?frame=true" rel="nofollow">EscapeCommFunction</a><br />
Abfragen: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/getcommmodemstatus.asp?frame=true" rel="nofollow">GetCommModemStatus</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/454524</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/454524</guid><dc:creator><![CDATA[-King-]]></dc:creator><pubDate>Sun, 08 Feb 2004 15:59:48 GMT</pubDate></item><item><title><![CDATA[Reply to zugriff auf die serial port, handshake on Sun, 08 Feb 2004 16:09:04 GMT]]></title><description><![CDATA[<p>feisten dank.</p>
<p>du hast mir das leben gerettet.!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/454530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/454530</guid><dc:creator><![CDATA[_um]]></dc:creator><pubDate>Sun, 08 Feb 2004 16:09:04 GMT</pubDate></item></channel></rss>