<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Serial communication using C++' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Serial communication using C++' posted on the 'Visual C++' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 06:13:37 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 06:13:37 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Serial communication using C++</title>
      <link>http://www.programmersheaven.com/mb/vcpage/419719/419719/serial-communication-using-c++/</link>
      <description>I am using visual studio 10 but i am unable to send data through that code........... Can anyone tell me problem in that code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include "stdafx.h"&lt;br /&gt;
#include&amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;windows.h&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
bool WriteComPort(char data);&lt;br /&gt;
&lt;br /&gt;
int main ()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	char again;&lt;br /&gt;
	do&lt;br /&gt;
	{ &lt;br /&gt;
		char data;&lt;br /&gt;
		bool check;&lt;br /&gt;
		cout&amp;lt;&amp;lt;" Enter data to be send   ";&lt;br /&gt;
		cin&amp;gt;&amp;gt;data;&lt;br /&gt;
		check=WriteComPort(data);&lt;br /&gt;
		if(check==0)&lt;br /&gt;
			cout&amp;lt;&amp;lt;"\nError occur... Data transmit not possible \n";&lt;br /&gt;
		else&lt;br /&gt;
			cout&amp;lt;&amp;lt;"Data successfully transmitted    ";&lt;br /&gt;
		cout&amp;lt;&amp;lt;"   More data transmission require y or n \n";&lt;br /&gt;
		cin&amp;gt;&amp;gt;again;&lt;br /&gt;
	}&lt;br /&gt;
	while (again=='y');&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
bool WriteComPort( char data)&lt;br /&gt;
{&lt;br /&gt;
	DCB dcb;&lt;br /&gt;
	DWORD byteswritten;&lt;br /&gt;
	HANDLE hPort = CreateFile("\\\\.\\COM11",GENERIC_WRITE,0,NULL,OPE
N_EXISTING,0,NULL);&lt;br /&gt;
	if (!GetCommState(hPort,&amp;amp;dcb))&lt;br /&gt;
		return false;&lt;br /&gt;
	dcb.BaudRate = CBR_9600; //9600 Baud&lt;br /&gt;
	dcb.ByteSize = 8; //8 data bits&lt;br /&gt;
	dcb.Parity = NOPARITY; //no parity&lt;br /&gt;
	dcb.StopBits = ONESTOPBIT; //1 stop&lt;br /&gt;
	if (!SetCommState(hPort,&amp;amp;dcb))&lt;br /&gt;
		return false;&lt;br /&gt;
	bool retVal = WriteFile(hPort,&amp;amp;data,1,&amp;amp;byteswritten,NULL);&lt;br /&gt;
	CloseHandle(hPort); //close the handle&lt;br /&gt;
	return retVal;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vcpage/419719/419719/serial-communication-using-c++/</guid>
      <pubDate>Mon, 15 Nov 2010 14:33:39 -0700</pubDate>
      <category>Visual C++</category>
    </item>
    <item>
      <title>Re:  Serial communication using C++</title>
      <link>http://www.programmersheaven.com/mb/vcpage/419719/422522/re--serial-communication-using-c++/#422522</link>
      <description>check the port existing, the program is working fine.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vcpage/419719/422522/re--serial-communication-using-c++/#422522</guid>
      <pubDate>Thu, 17 Mar 2011 06:10:19 -0700</pubDate>
      <category>Visual C++</category>
    </item>
  </channel>
</rss>