<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brian Paden&#039;s somewhat technical blog &#187; c++</title>
	<atom:link href="http://www.college-code.com/blog/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://www.college-code.com/blog</link>
	<description>The mostly tech related musings of a Software Engineering grad student</description>
	<lastBuildDate>Tue, 04 May 2010 06:38:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Boost Asio Serial_Port Demo</title>
		<link>http://www.college-code.com/blog/2008/boost-asio-serial_port-demo</link>
		<comments>http://www.college-code.com/blog/2008/boost-asio-serial_port-demo#comments</comments>
		<pubDate>Fri, 07 Nov 2008 07:20:49 +0000</pubDate>
		<dc:creator>Brian Paden</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[serial ports]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.college-code.com/blog/?p=96</guid>
		<description><![CDATA[So I&#8217;ve recently started playing with hardware more.  This necessitated learning how to communicate my C++ with the actual hardware.  The de facto method for this for decades has been the RS232 serial port.  But how to actually use this to talk with code? In Unix you can directly talk to dev/ttyS0 or wherever the [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve recently started playing with hardware more.  This necessitated learning how to communicate my C++ with the actual hardware.  The de facto method for this for decades has been the RS232 serial port.  But how to actually use this to talk with code?</p>
<p>In Unix you can directly talk to dev/ttyS0 or wherever the device is located.  Windows gives you some com stuff to talk to it.  But is there a way to do it cross platform?</p>
<p>Of course there is, otherwise I wouldn&#8217;t write about it.  Enter Boost, the pivotal C++ library.  In Boost::Asio (ASynchronous Input/Output) there exists a serial_port class.  Seems to be good enough, all that is left is to get it to work.  Easier said than done.  There are basically no examples and the doc&#8217;s aren&#8217;t very helpful (weren&#8217;t to me at least).</p>
<p>So here is a small program that covers most of what a serial_port class needs to do.  You set the parameters before the program starts (certain os&#8217;s have limits built in, like you must set the baud rate beforehand etc).  The hardware this talks to takes a baud rate of 19200, 8 bits of data, no parity, and 1 stop bit.  My test board only read input so the example doesn&#8217;t take input yet.  Check the comments for more details, the license is at the top of the file.</p>
<p>Due to the stupidity of WordPress the code format kept getting eaten so you have to download the file instead.</p>
<p>Link to file: <a href="http://www.college-code.com/blog/wp-content/uploads/2008/11/boost_serial_port_demo.cpp">boost_serial_port_demo.cpp</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.college-code.com/blog/2008/boost-asio-serial_port-demo/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

