<?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>K&#039;s Lair &#187; c++</title>
	<atom:link href="http://andreas.goelzer.de/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://andreas.goelzer.de</link>
	<description>Electronics and small programs and other stuff</description>
	<lastBuildDate>Thu, 02 Sep 2010 12:30:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>lcdshift</title>
		<link>http://andreas.goelzer.de/lcdshift</link>
		<comments>http://andreas.goelzer.de/lcdshift#comments</comments>
		<pubDate>Tue, 31 Mar 2009 14:45:40 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[lcd]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=122</guid>
		<description><![CDATA[LCD Controllers using an HD44780 Display Controller are commonly used for small batch electronic devices, and are popular with electronics fans worldwide. One problem with those controllers is their demand for IO-lines, due too the parallel interface they require at &#8230; <a href="http://andreas.goelzer.de/lcdshift">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>LCD Controllers using an <a href="http://www.alldatasheet.com/datasheet-pdf/pdf/63673/HITACHI/HD44780.html">HD44780</a> Display Controller are commonly used for small batch electronic devices, and are popular with electronics fans worldwide. One problem with those controllers is their demand for IO-lines, due too the parallel interface they require at least 7 IO lines.</p>
<p>One solution, if you don&#8217;t have enough IO ports to spare, is to use another Display, like serial <a href="http://superkranz.de/christian/S65_Display/DisplayIndex.html">cellphone displays</a>, which are cheap and color is a great thing to show off. Or you can expand the number of IO lines by using a shift register or TWI device. This is one such implementation using a <a href="http://www.datasheetcatalog.org/datasheet/motorola/74HC164.pdf">74hc164</a> shift register. It is based on an <a href="http://www.mikrocontroller.net/topic/6496">implementation</a> by Peter Dannegger. If you prefer to use a 4094 cmos shift register, there are also <a href="http://bansky.net/blog/2008/10/interfacing-lcd-with-3-wires-from-net-micro-framework/">schematics</a>  floating around the net.<br />
<div class="ngg-galleryoverview" id="ngg-gallery--122">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-11958" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/lcdshift/lcdshift_schematic.png" title="lcdshift_schematic.png" class="thickbox" rel="lcdshift" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/lcdshift/thumbs/thumbs_lcdshift_schematic.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11959" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/lcdshift/lcdshift_assembly.png" title="lcdshift_assembly.png" class="thickbox" rel="lcdshift" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/lcdshift/thumbs/thumbs_lcdshift_assembly.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>

<br />
The idea behind this implementation is to fill the shift register from the microcontroller using hard- or softspi, then toggle the hd44780&#8242;s enable pin. While toggling, the data pin determines the R/S state of the display.</p>
<p>The demo software will print a hello world message onto the display, it is written for AVR microcontrollers, it should work &#8211; after modifying the ports and pin numbers &#8211; on almost any AVR. Peter Daneggers <a href="http://www.mikrocontroller.net/attachment/highlight/1929">original software</a> is written for 8051 µCs, I don&#8217;t know of any code for PICs.</p>
<hr /><a href='http://andreas.goelzer.de/download/lcd.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> lcd.tar.bz2</a> (2.30 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.pdf</a> (13.73 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.sch'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.sch</a> (94.29 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.brd'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.brd</a> (12.28 kiB, 2009-03-31)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/lcdshift/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>readESM &#8211; Reading Digital Tachograph files</title>
		<link>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files</link>
		<comments>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files#comments</comments>
		<pubDate>Tue, 10 Feb 2009 02:33:51 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Vehicles]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[tachograph]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=111</guid>
		<description><![CDATA[For several years now, new trucks sold in the European union are equipped with digital tachographs, that record the driving times and replace the older chart-based mechanical tachographs. For companies in road transport that means, although in theory they get &#8230; <a href="http://andreas.goelzer.de/readesm-reading-digital-tachograph-files">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For several years now, new trucks sold in the European union are equipped with digital tachographs, that record the driving times and replace the older chart-based mechanical tachographs.</p>
<p>For companies in road transport that means, although in theory they get nice data about their drivers and vehicles, in practice they have to pay a lot of money for the digital tachograph and the associated equipment, which is then used against them &#8211; the old fraud schemes no longer work, the machine cruelly gives every police officer the driving times of the last 28 days (and could give much more).</p>
<p>The usability of the devices I&#8217;m familiar with is also abysmal. It just takes forever to read out the data (9600 baud per default, 115000 baud maximal, but i guess the company&#8217;s software does just the former), and the drivers have to keep track of their times manually &#8211; just not up to par with 2009 technology.</p>
<p>The company also had just a very bad software for analyzing the data recorded by the card and the digital tachograph, so I was asked to write a simple visualization program.</p>
<h3>Compiling</h3>
<p>You can get the program files from this page, or from the <a href="http://sourceforge.net/projects/readesm/">development page</a> at Sourceforge.<br />
Since so far there is no binary distribution for the program, you will have to compile it yourself.<br />
To do that, you need a c++ compiler, parts of the <a href="http://www.boost.org/">boost library</a> (specifically program_options and shared_ptr) and the <a href="http://gmplib.org/">Gnu MP library</a>, wich is used to check the various <a href="http://en.wikipedia.org/wiki/RSA">RSA</a> signatures. Once all those are installed, typing make/make install should work fine. On <a href="http://www.ubuntu.com/">Ubuntu</a> systems, you will need to do something like:</p>
<pre>svn co https://readesm.svn.sourceforge.net/svnroot/readesm readesm
sudo apt-get install libboost-program-options-dev libgmpxx4ldbl  libgmp3-dev
make
sudo make install
</pre>
<p>You can of course also use checkinstall instead of make install, or type make package, which invokes checkinstall.</p>
<h3>Running the program</h3>
<p>In most circumstances, you will run the program from the commandline like this:</p>
<pre>readesm --infile foo.esm --outfile bar.html --format=html</pre>
<p>Alternatively, if no output file is specified, stdout is used. For <a href="http://www.kde.org/">KDE</a> users, i wrote a little wrapper script named readesm-wrap-kde.sh. It will get installed my typing make install</p>
<h3>Security</h3>
<p>It is a really pleasant surprise to see a nice security model in the digital tachographs, considering the rules for the security implementations were made by politicians. Both cards and vehicle units work with 1024-bit RSA keys, and each vehicle unit has its own key, with an certificate signed by the member state, which in turn is signed by an European master key. Data is hashed with SHA-1, subsequently padded and signed by the vehicle unit, and that signature appended to the readouts. The law even states that the companies have to store the data in this signed form, so there is little chance to tamper with the data, once recorded.</p>
<p>Since the most likely attacker &#8211; the evil manager who wants to exploit the drivers &#8211; has physical access to the card and vehicle unit, which contain the private keys, even 1024-bit RSA provides no absolute security. The manager could try a timing attack, or take a really close look at the storage, both times avoiding having to solve the RSA problem.</p>
<p>The connection from tachograph to sensor is also secured, using Triple-DES. The week point here is the sensor &#8211; a successful attack against the sensors some DAF trucks are equipped with is to disturb it using strong permanent magnets, thereby preventing it from recognizing the changing magnetic fields.</p>
<p>All possible attacks against the security system however face the problem of being unveiled by police checkpoints or a cross-correlation of the faked data with data from other sources, for example the toll systems recording every few highway kilometers in Germany.</p>
<p>So, although I could sell manipulation programs for quite some money, all I can offer is a program that can detect such attacks <img src='http://andreas.goelzer.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="ngg-galleryoverview" id="ngg-gallery--111">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-11673" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/alpha_html_output.png" title="alpha_html_output.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_alpha_html_output.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11674" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/card_error.png" title="card_error.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_card_error.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11675" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/alpha_html_control.png" title="alpha_html_control.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_alpha_html_control.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-12798" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/readesm_0.3.2_german_locale.png" title="readesm_0.3.2_german_locale.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_readesm_0.3.2_german_locale.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-12801" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/readesm_0.3.2_windows_xml_2.PNG" title="readesm_0.3.2_windows_xml_2.PNG" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_readesm_0.3.2_windows_xml_2.PNG" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>

<br /><hr /><a href='http://andreas.goelzer.de/download/readesm.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> readesm.tar.bz2</a> (60.86 kiB, 2009-05-19)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: andreas.goelzer.de @ 2010-09-06 07:53:40 -->