<?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>gonium.net &#187; clock</title>
	<atom:link href="http://gonium.net/md/tag/clock/feed/" rel="self" type="application/rss+xml" />
	<link>http://gonium.net/md</link>
	<description>so much time, so little to do.</description>
	<lastBuildDate>Fri, 30 Jul 2010 13:47:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tweaking the code</title>
		<link>http://gonium.net/md/2007/04/18/tweaking-the-code/</link>
		<comments>http://gonium.net/md/2007/04/18/tweaking-the-code/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 14:54:47 +0000</pubDate>
		<dc:creator>md</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[digital]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[ATMega]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dcf77]]></category>

		<guid isPermaLink="false">http://gonium.net/md/2007/04/18/tweaking-the-code/</guid>
		<description><![CDATA[


Thanks to Lasse Lambrecht, I can release a new version of the DCF77 code &#8211; now you can run it on the ATMega168-based Arduinos.



The ATMega8 differs slightly from the ATMega48/88/168-series: The latter chips have an extended Timer2-hardware and therefore need different initializations. Lasse send me a nice adjustment of the code, basically he uses preprocessor [...]]]></description>
			<content:encoded><![CDATA[<img src='http://gonium.net/md/wp-content/uploads/2007/04/tweaking.png' alt='tweaking.png' />
<br />

<p>Thanks to <a href="http://www.lobl.de">Lasse Lambrecht</a>, I can release a new version of the DCF77 code &#8211; now you can run it on the ATMega168-based Arduinos.</p>

<span id="more-55"></span>

The ATMega8 differs slightly from the ATMega48/88/168-series: The latter chips have an extended Timer2-hardware and therefore need different initializations. Lasse send me a nice adjustment of the code, basically he uses preprocessor flags to figure out which initialization commands to use:


#ifdef ATMEGA168
  TCCR2B |= (1< <CS22);    // turn on CS22 bit
  TCCR2B &#038;= ~((1<<CS21) | (1<<CS20));    // turn off CS21 and CS20 bits   
#else
  TCCR2 |= (1<<CS22);    // turn on CS22 bit
  TCCR2 &#038;= ~((1<<CS21) | (1<<CS20));    // turn off CS21 and CS20 bits   
#endif
  // Use normal mode
#ifdef ATMEGA168
  TCCR2A &#038;= ~((1<<WGM21) | (1<<WGM20));   // turn off WGM21 and WGM20 bits 
  TCCR2B &#038;= ~(1<<WGM22);                  // turn off WGM22
#else
  TCCR2 &#038;= ~((1<<WGM21) | (1<<WGM20));   // turn off WGM21 and WGM20 bits 
#endif
  // Use internal clock - external clock not used in Arduino
  ASSR |= (0<<AS2);
#ifdef ATMEGA168
  TIMSK2 |= (1<<TOIE2) | (0<<OCIE2A);        //Timer2 Overflow Interrupt Enable  
#else
  TIMSK |= (1<<TOIE2) | (0<<OCIE2);        //Timer2 Overflow Interrupt Enable  
#endif


As you can see, the avr-libc just defines other names, e.g. TCCR2A/B for the ATMega168 and TCCR2 for the ATMega8.

You can get the new code here
<ul>
	<li><a href="http://gonium.net/media/arduino-dcf77-clock-0.2.1.tar.bz">arduino-dcf77-clock-0.2.1.tar.bz</a></li>


For the hardware setup, please refer to my <a href="http://gonium.net/md/2006/11/05/arduino-dcf77-radio-clock-receiver/">initial post</a>.

]]></content:encoded>
			<wfw:commentRss>http://gonium.net/md/2007/04/18/tweaking-the-code/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Arduino DCF77 v0.2 released</title>
		<link>http://gonium.net/md/2007/01/06/arduino-dcf77-v02-released/</link>
		<comments>http://gonium.net/md/2007/01/06/arduino-dcf77-v02-released/#comments</comments>
		<pubDate>Sat, 06 Jan 2007 22:52:15 +0000</pubDate>
		<dc:creator>md</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[dcf77]]></category>
		<category><![CDATA[microcontroller]]></category>

		<guid isPermaLink="false">http://gonium.net/md/2007/01/06/arduino-dcf77-v02-released/</guid>
		<description><![CDATA[
The sketch for decoding the time radio signal DCF77 is greatly improved: I use interrupts for handling the signal and a backup timer has been added.

Note that there is no interface at the moment, the time is simply put to the serial line. But it should be easy to add a display to show the [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image35" src="http://gonium.net/md/wp-content/uploads/2007/01/457-nixie.jpg" alt="4:57 nixietube clock" /></p>
<p>The sketch for decoding the time radio signal DCF77 is greatly improved: I use interrupts for handling the signal and a backup timer has been added.</p>
<p><span id="more-34"></span></p>
<p>Note that there is no interface at the moment, the time is simply put to the serial line. But it should be easy to add a display to show the time. The sketch eats roughly 6000 bytes of memory &#8211; if you want to add a user interface, you should consider buying a 16 kb Arduino ;-)</p>
<p>Of course, you also need the DCF77 receiver module and a pullup-resistor, as described in my <a href="http://gonium.net/md/2006/11/05/arduino-dcf77-radio-clock-receiver/">old post</a>.</p>
<p>You can download the code here:</p>
<ul>
<li><a href="http://gonium.net/media/arduino-dcf77-clock-0.2.0.tar.bz">arduino-dcf77-clock-0.2.0.tar.bz</a></li>
</ul>
<p>BTW: The picture above shows a Nixie tube clock. I ripped the picture shamelessly from flickr, there&#8217;s a <a href="http://flickr.com/photos/thephoton/sets/72057594111675418/">photostream</a> showing the creation of the clock. Cool project.</p>
]]></content:encoded>
			<wfw:commentRss>http://gonium.net/md/2007/01/06/arduino-dcf77-v02-released/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
