<?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>John&#039;s Ramblings &#187; xml</title>
	<atom:link href="http://john.crouchley.com/blog/archives/tag/xml/feed" rel="self" type="application/rss+xml" />
	<link>http://john.crouchley.com/blog</link>
	<description>Personal record for family and friends - contact me: john at crouchley.me.uk</description>
	<lastBuildDate>Fri, 03 Feb 2012 13:30:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A TinyXML library for the Arduino</title>
		<link>http://john.crouchley.com/blog/archives/454</link>
		<comments>http://john.crouchley.com/blog/archives/454#comments</comments>
		<pubDate>Mon, 11 Jan 2010 19:14:37 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=454</guid>
		<description><![CDATA[<p>A lot of devices use XML these days &#8211; and parsing the XML by hand is quite complex. I use a CurrentCost CC128 power monitor and also Twitter. Both of these have an XML interface.</p> <p>Over the last couple of months I have been developing a simple XML parser as an Arduino library &#8211; it [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of devices use XML these days &#8211; and parsing the XML by hand is quite complex. I use a CurrentCost CC128 power monitor and also Twitter. Both of these have an XML interface.</p>
<p>Over the last couple of months I have been developing a simple XML parser as an Arduino library &#8211; it is table driven and so compact and easily modified. This is now ready for release &#8211; you can download it <a href="http://john.crouchley.com/files/TinyXML.zip">here</a>. The CC-128 example compiles at less than 9kB.</p>
<p>I have included a Twitter API example and also a CurrentCost CC-128 example.</p>
<p>The CC-128 example is being used to provide a data concentrator for CC-128. I am using an Arduino (Mini Pro 328) to take the cpu burden off the main Arduino,  processing serial data at 57600 baud takes up most of the power of an Arduino.</p>
<p>Connect the Mini Pro to the CC-128 using GND and CC-128 Tx to Mini Pro pin digital 1. The Mini Pro acts as an I2C slave for the main Arduino (simple connection &#8211; just link up GND, A4 and A5 &#8211; also 5V if you don&#8217;t have a separate power supply).</p>
<p>I have three current cost devices feeding the CC-128 &#8211; Electricity, Gas and a light sensor. It should be quite easy to modify the example for your configuration.</p>
<p>Master code to read from the CC128 I2C slave is roughly as follows<br />
<code><br />
  CC128Data cc128data;   // structure definition is held in the .h file</p>
<p>  Wire.beginTransmission(I2CADDR);<br />
  Wire.send(COMMAND);<br />
  Wire.send(SNAPSHOT | READALL);<br />
  Wire.endTransmission();<br />
  delay(5);      // give the I2C transmission and the slave time to deal with request<br />
                 // 2mS does not work - 3 does - give it 5 to be safe<br />
  Wire.requestFrom(I2CADDR, sizeof(CC128Data));    // request data structure bytes from slave device<br />
  byte* b = (byte*)&#038;cc128data;<br />
  for (int i = 0; i&lt;sizeof (CC128Data); i++)<br />
  {<br />
    *b++ = Wire.receive(); // receive a byte as character<br />
  }<br />
</code><br />
I will be writing up another post about the CC-128 data concentrator and the main Arduino, describing how to set up multiple I2C slaves all linked to a central Arduino CPU.</p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/454/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

