<?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>HackDevDotCom &#187; Projects</title>
	<atom:link href="http://hackdev.com/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackdev.com</link>
	<description>Hacked Development</description>
	<lastBuildDate>Thu, 10 Jun 2010 22:55:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>LED Matrix Displays</title>
		<link>http://hackdev.com/2010/05/led-matrix-displays/</link>
		<comments>http://hackdev.com/2010/05/led-matrix-displays/#comments</comments>
		<pubDate>Sun, 23 May 2010 23:13:47 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=157</guid>
		<description><![CDATA[*Updated small bug where I forgot to enable the system afterwards&#8230; I&#8217;ve managed to pick up a few LED matrix displays from Sure Electronics that use the HT1632 LED Matrix driver, as such, I have written a new library for the Arduino project to make use of the displays, I haven&#8217;t done anything in relation [...]]]></description>
			<content:encoded><![CDATA[<p>*Updated small bug where I forgot to enable the system afterwards&#8230;</p>
<p>I&#8217;ve managed to pick up a few LED matrix displays from Sure Electronics that use the HT1632 LED Matrix driver, as such, I have written a new library for the Arduino project to make use of the displays, I haven&#8217;t done anything in relation to generating characters for them or doing any scrolling, but I can now pretty much call all of the features of the handy driver. There is still some work to do on cleaning up the library and adding some more functionality, but it does indeed work as it should. Here is the source&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
&nbsp;
    Holtech HT1632 Driver Class (Header)
    Values taken from Datasheet...
&nbsp;
*/</span>
&nbsp;
<span style="color: #339933;">#ifndef HT1632_h</span>
<span style="color: #339933;">#define HT1632_h</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Data Mode</span>
<span style="color: #339933;">#define HT1632_CTL_COMMAND      0x04    //Preceeds all _COMMANDS_ to the system</span>
<span style="color: #339933;">#define HT1632_CTL_WRITE        0x05    //Write data to the RAM</span>
<span style="color: #339933;">#define HT1632_CTL_READ         0x06    //Read data from the RAM</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Command Mode</span>
<span style="color: #339933;">#define HT1632_CMD_SYSDIS       0x00    //Turn off system oscillator and LED duty cycle generator</span>
<span style="color: #339933;">#define HT1632_CMD_SYSEN        0x01    //Turn on system oscillator</span>
<span style="color: #339933;">#define HT1632_CMD_LEDOFF       0x02    //Turn off LED duty cycle generator</span>
<span style="color: #339933;">#define HT1632_CMD_LEDON        0x03    //Turn on LED duty cycle generator</span>
<span style="color: #339933;">#define HT1632_CMD_BLINKOFF     0x08    //Turn off blinking function</span>
<span style="color: #339933;">#define HT1632_CMD_BLINKON      0x09    //Turn on blinking function</span>
<span style="color: #339933;">#define HT1632_CMD_SLAVEMODE    0x10    //Set slave mode and clock source from external clock, the system clock input from OSC pin and synchronous signal input from SYN pin</span>
<span style="color: #339933;">#define HT1632_CMD_RCMASTER     0x18    //Set master mode anc clock source from on-chip RC oscillator, the system clock output to OSC pin and synchronous signal output SYN pin</span>
<span style="color: #339933;">#define HT1632_CMD_EXTCLK       0x1C    //System clock source, external</span>
<span style="color: #339933;">#define HT1632_CMD_COM00        0x20    //N-MOS open drain output and 8 COM option</span>
<span style="color: #339933;">#define HT1632_CMD_COM01        0x24    //N-MOS open drain output and 8 COM option</span>
<span style="color: #339933;">#define HT1632_CMD_COM10        0x28    //P-MOS open drain output and 8 COM option</span>
<span style="color: #339933;">#define HT1632_CMD_COM11        0x2C    //P-MOS open drain output and 16 COM option</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Command Mode - PWM Settings</span>
<span style="color: #339933;">#define HT1632_CMD_PWM01        0xA0    //PWM 1/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM02        0xA1    //PWM 2/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM03        0xA2    //PWM 3/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM04        0xA3    //PWM 4/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM05        0xA4    //PWM 5/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM06        0xA5    //PWM 6/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM07        0xA6    //PWM 7/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM08        0xA7    //PWM 8/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM09        0xA8    //PWM 9/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM10        0xA9    //PWM 10/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM11        0xAA    //PWM 11/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM12        0xAB    //PWM 12/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM13        0xAC    //PWM 13/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM14        0xAD    //PWM 14/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM15        0xAE    //PWM 15/16 Duty</span>
<span style="color: #339933;">#define HT1632_CMD_PWM16        0xAF    //PWM 16/16 Duty</span>
&nbsp;
<span style="color: #339933;">#include &quot;wProgram.h&quot;</span>
&nbsp;
class HT1632 <span style="color: #009900;">&#123;</span>
    public<span style="color: #339933;">:</span>
        HT1632<span style="color: #009900;">&#40;</span>byte data<span style="color: #339933;">,</span> byte wclock<span style="color: #339933;">,</span> byte chip0<span style="color: #339933;">,</span> byte chip1<span style="color: #339933;">=</span>NULL<span style="color: #339933;">,</span> byte chip2<span style="color: #339933;">=</span>NULL<span style="color: #339933;">,</span> byte chip3<span style="color: #339933;">=</span>NULL<span style="color: #339933;">,</span> byte rclock<span style="color: #339933;">=</span>NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> ChipSelect<span style="color: #009900;">&#40;</span>byte chip<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> ChipRelease<span style="color: #009900;">&#40;</span>byte chip<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> SendCommand<span style="color: #009900;">&#40;</span>byte command<span style="color: #339933;">,</span> byte chip<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> WriteBits<span style="color: #009900;">&#40;</span>byte bits<span style="color: #339933;">,</span> byte mask<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        byte ReadData<span style="color: #009900;">&#40;</span>byte address<span style="color: #339933;">,</span> byte chip<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> Clear<span style="color: #009900;">&#40;</span>byte chip<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> WriteData<span style="color: #009900;">&#40;</span>byte address<span style="color: #339933;">,</span> byte data<span style="color: #339933;">,</span> byte chip<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> Init<span style="color: #009900;">&#40;</span>byte chip<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">void</span> BlinkMode<span style="color: #009900;">&#40;</span>bool blink<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span> byte chip<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    private<span style="color: #339933;">:</span>
        byte _DATA<span style="color: #339933;">;</span>
        byte _WCLOCK<span style="color: #339933;">;</span>
        byte _RCLOCK<span style="color: #339933;">;</span>
        byte _CHIP0<span style="color: #339933;">;</span>
        byte _CHIP1<span style="color: #339933;">;</span>
        byte _CHIP2<span style="color: #339933;">;</span>
        byte _CHIP3<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">#endif</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
&nbsp;
    Holtech HT1632 Driver Class
    Some functionality inspired by westfw from this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439
&nbsp;
*/</span>
&nbsp;
<span style="color: #339900;">#include &quot;wProgram.h&quot;</span>
<span style="color: #339900;">#include &quot;HT1632.h&quot;</span>
&nbsp;
HT1632<span style="color: #008080;">::</span><span style="color: #007788;">HT1632</span><span style="color: #008000;">&#40;</span>byte data, byte wclock, byte chip0, byte chip1, byte chip2, byte chip3, byte rclock<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">//Set the I/O Directions</span>
    pinMode<span style="color: #008000;">&#40;</span>data, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    pinMode<span style="color: #008000;">&#40;</span>wclock, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>rclock<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        pinMode<span style="color: #008000;">&#40;</span>rclock, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        _RCLOCK <span style="color: #000080;">=</span> rclock<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    pinMode<span style="color: #008000;">&#40;</span>chip0, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    digitalWrite<span style="color: #008000;">&#40;</span>chip0, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    _CHIP0 <span style="color: #000080;">=</span> chip0<span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>chip1<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        pinMode<span style="color: #008000;">&#40;</span>chip1, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        digitalWrite<span style="color: #008000;">&#40;</span>chip1, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        _CHIP1 <span style="color: #000080;">=</span> chip1<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>chip2<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        pinMode<span style="color: #008000;">&#40;</span>chip2, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        digitalWrite<span style="color: #008000;">&#40;</span>chip2, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        _CHIP2 <span style="color: #000080;">=</span> chip2<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>chip3<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        pinMode<span style="color: #008000;">&#40;</span>chip3, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        digitalWrite<span style="color: #008000;">&#40;</span>chip3, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        _CHIP2 <span style="color: #000080;">=</span> chip2<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    _DATA <span style="color: #000080;">=</span> data<span style="color: #008080;">;</span>
    _WCLOCK <span style="color: #000080;">=</span> wclock<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">ChipSelect</span><span style="color: #008000;">&#40;</span>byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP0, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP1, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">2</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP2, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP3, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">ChipRelease</span><span style="color: #008000;">&#40;</span>byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP0, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP1, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">2</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP2, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">:</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_CHIP3, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">WriteBits</span><span style="color: #008000;">&#40;</span>byte bits, byte mask<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>mask<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        digitalWrite<span style="color: #008000;">&#40;</span>_WCLOCK, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>bits <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span> mask<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_DATA, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span> <span style="color: #0000ff;">else</span> <span style="color: #008000;">&#123;</span>
            digitalWrite<span style="color: #008000;">&#40;</span>_DATA, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        digitalWrite<span style="color: #008000;">&#40;</span>_WCLOCK, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        mask <span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span><span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">SendCommand</span><span style="color: #008000;">&#40;</span>byte command, byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    ChipSelect<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    WriteBits<span style="color: #008000;">&#40;</span>HT1632_CTL_COMMAND, <span style="color: #0000dd;">1</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><span style="color: #666666;">//3 bit command id</span>
    WriteBits<span style="color: #008000;">&#40;</span>command, <span style="color: #0000dd;">1</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">7</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><span style="color: #666666;">//8 bit command</span>
    WriteBits<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><span style="color: #666666;">//There's one extra bit in commands that dont matter...</span>
    ChipRelease<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
byte HT1632<span style="color: #008080;">::</span><span style="color: #007788;">ReadData</span><span style="color: #008000;">&#40;</span>byte address, byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">//Do stuff here to read the data from the chip...</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">Clear</span><span style="color: #008000;">&#40;</span>byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    ChipSelect<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i<span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">256</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        WriteData<span style="color: #008000;">&#40;</span>i, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    ChipRelease<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">WriteData</span><span style="color: #008000;">&#40;</span>byte address, byte data, byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    ChipSelect<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><span style="color: #666666;">//Select the chip...</span>
    <span style="color: #666666;">//Send the WRITE command...</span>
    WriteBits<span style="color: #008000;">&#40;</span>HT1632_CTL_WRITE, <span style="color: #0000dd;">1</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  <span style="color: #666666;">//3 bit command</span>
    <span style="color: #666666;">//Send the Address...</span>
    WriteBits<span style="color: #008000;">&#40;</span>address, <span style="color: #0000dd;">1</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">6</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>   <span style="color: #666666;">//7 bit address</span>
    <span style="color: #666666;">//Send the data...</span>
    WriteBits<span style="color: #008000;">&#40;</span>data, <span style="color: #0000dd;">1</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//4 bit data</span>
    ChipRelease<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><span style="color: #666666;">//Release the chip...</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">Init</span><span style="color: #008000;">&#40;</span>byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_SYSDIS<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Disable system</span>
    SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_COM11<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//PMOS drivers</span>
    SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_RCMASTER<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Master mode</span>
    SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_SYSEN<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//System Enable</span>
    SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_LEDON<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Enable the display</span>
    Clear<span style="color: #008000;">&#40;</span>chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> HT1632<span style="color: #008080;">::</span><span style="color: #007788;">BlinkMode</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">bool</span> blink, byte chip<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>blink<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_BLINKON, chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span> <span style="color: #0000ff;">else</span> <span style="color: #008000;">&#123;</span>
        SendCommand<span style="color: #008000;">&#40;</span>HT1632_CMD_BLINKOFF, chip<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2010/05/led-matrix-displays/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Just a general update&#8230;</title>
		<link>http://hackdev.com/2010/04/just-a-general-update/</link>
		<comments>http://hackdev.com/2010/04/just-a-general-update/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 20:48:55 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[Fixes / Patches]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Mancave]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=144</guid>
		<description><![CDATA[It&#8217;s been quite a while since I&#8217;ve posted  anything, I&#8217;ve been very busy lately but since I&#8217;m out sick now for a few days, I have a bit of time to update&#8230; If you have tried to play Fallout 3 using an Asus branded NVidia card, and it crashes stating &#8220;Fallout 3 has stopped working&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a while since I&#8217;ve posted  anything, I&#8217;ve been very busy lately but since I&#8217;m out sick now for a few days, I have a bit of time to update&#8230;</p>
<p>If you have tried to play Fallout 3 using an Asus branded NVidia card, and it crashes stating &#8220;Fallout 3 has stopped working&#8221; every time you try to load a new game, check and see if you have Asus Gamer OSD installed, if you do, get rid of it. Something the overlay does interferes with the game  and causes this to happen&#8230;</p>
<p>I have been doing some more work on the lighting for the man cave so I have some Python code that will pull the Average color (not the most predominant, yet, wont be hard, but I am lazy) so here it is, please keep in mind its not nice, fast or clean&#8230; for high res images it takes a few seconds to do its thing&#8230;</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># PIL Image Module Handbook - http://www.pythonware.com/library/pil/handbook/image.htm</span>
<span style="color: #808080; font-style: italic;">#</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> PIL <span style="color: #ff7700;font-weight:bold;">import</span> Image
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> processImageAverage<span style="color: black;">&#40;</span>imageFile<span style="color: black;">&#41;</span>:
    image = Image.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>imageFile<span style="color: black;">&#41;</span>     <span style="color: #808080; font-style: italic;">#open the image for processing</span>
    pixels = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>image.<span style="color: black;">getdata</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>    <span style="color: #808080; font-style: italic;">#break the image down into a list of pixels, each pixel contains a list of red,green,blue</span>
&nbsp;
    totalpx = <span style="color: #ff4500;">0</span> <span style="color: #808080; font-style: italic;">#set some default values to start counting...</span>
    redpx = <span style="color: #ff4500;">0</span>
    greenpx = <span style="color: #ff4500;">0</span>
    bluepx = <span style="color: #ff4500;">0</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> pixel <span style="color: #ff7700;font-weight:bold;">in</span> pixels:    <span style="color: #808080; font-style: italic;">#loop through the lists and build the values.</span>
        totalpx += <span style="color: #ff4500;">1</span>
        redpx += pixel<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
        greenpx += pixel<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
        bluepx += pixel<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
&nbsp;
    redavg = redpx / totalpx   <span style="color: #808080; font-style: italic;">#generate the averages</span>
    greenavg = greenpx / totalpx
    blueavg = bluepx / totalpx
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Total Pixels:<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, totalpx     <span style="color: #808080; font-style: italic;">#and write them out.</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Red Average:<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, redavg
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Green Average:<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, greenavg
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Blue Average:<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, blueavg
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;HEX Color:<span style="color: #000099; font-weight: bold;">\t</span>#%x%x%x&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>redavg, greenavg, blueavg<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Usage: %prog source&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: black;">&#40;</span>options, arguments<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>arguments<span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff4500;">1</span>:
        <span style="color: #dc143c;">parser</span>.<span style="color: black;">error</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Please specify a single input file.&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    processImageAverage<span style="color: black;">&#40;</span>arguments<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

</p>
<p>I have a new job now, I&#8217;m no longer a software validation engineer (tester), I&#8217;m now an IT Support Engineer (IT Techie&#8230;) which is kinda nice&#8230;.</p>
<p>Well&#8230; that is for now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2010/04/just-a-general-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New addition to the ManCave for the bar&#8230;</title>
		<link>http://hackdev.com/2010/02/new-addition-to-the-mancave-for-the-bar/</link>
		<comments>http://hackdev.com/2010/02/new-addition-to-the-mancave-for-the-bar/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 17:09:50 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[Mancave]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=137</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img src="http://img519.imageshack.us/img519/8719/p140210164301.jpg" alt="http://img519.imageshack.us/img519/8719/p140210164301.jpg" width="512" height="384" /></p>
]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2010/02/new-addition-to-the-mancave-for-the-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>€1366.07 down&#8230;</title>
		<link>http://hackdev.com/2010/02/e1366-07-down/</link>
		<comments>http://hackdev.com/2010/02/e1366-07-down/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 14:34:31 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mancave]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=135</guid>
		<description><![CDATA[So I have been doing some serious work on my mancave during my two weeks off, so far I have all of the walls battened, the new door fitted, and two of the walls wired for mains sockets. I have even been picking up some additional parts that we are not quite ready yet, such [...]]]></description>
			<content:encoded><![CDATA[<p>So I have been doing some serious work on my mancave during my two weeks off, so far I have all of the walls battened, the new door fitted, and two of the walls wired for mains sockets. I have even been picking up some additional parts that we are not quite ready yet, such as a roll of CAT6 cable, CAT6 wall outlets with faceplate&#8217;s, 17 double gang switched sockets and much much more&#8230; all in all its coming along nicely. No photo&#8217;s taken as of yet though, I really should have taken some at the start and all the way through as it would have been quite a good evolution slide show, but alas its too late now&#8230; we did run into a few issues though, the garage is still crammed full of stuff and there is not much room to move around in it so that has been slowing us down a lot, however there is nowhere else to put it so it has to be this way for now I&#8217;m afraid <img src='http://hackdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Another issue we&#8217;ve encountered was that the cavity blocks haven&#8217;t aged all that well and are quite hard, like flint even, so masonry nails havent been working out too well on that, so as a more expensive, and time consuming work-around, we have been using nail-anchors and manually drilling for each baton&#8230; not the most fun thing in the world, but at least its progress&#8230;</p>
<p>As a side note, from working out in the cold weather all week I seem to have gotten another cold <img src='http://hackdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2010/02/e1366-07-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedded Linux Development</title>
		<link>http://hackdev.com/2009/11/embedded-linux-development/</link>
		<comments>http://hackdev.com/2009/11/embedded-linux-development/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 22:07:33 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=74</guid>
		<description><![CDATA[I work for a company that is currently utilising Linux on an embedded platform, now I am a big fan of Linux, and I do really like embedded systems&#8230; so the natural progression was to go and learn about embedded Linux development. I managed to find a really good book called the Embedded Linux Primer: [...]]]></description>
			<content:encoded><![CDATA[<p>I work for a company that is currently utilising Linux on an embedded platform, now I am a big fan of Linux, and I do really like embedded systems&#8230; so the natural progression was to go and learn about embedded Linux development. I managed to find a really good book called the <a href="http://www.amazon.com/gp/product/0131679848?ie=UTF8&amp;tag=hackdcom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0131679848">Embedded Linux Primer: A Practical Real-World Approach</a> which really is very good. So, as a kind of training exercise, I will be attempting to build my own customer miniture linux distribution (borrowing some things from other projects) for an embedded system. The board I have chosen is the BifferBoard which is available from http://www.bifferboard.com and is a very cheap x86 based system with a lot of handy features such as UART, JTAG, GPIO, Ethernet, really good board and again, really cheap, I paid around €30 for mine&#8230;</p>
<p>I do have a few goals that I intend to accheive in the proccess of doing this project and a few additional tools will be imported from other projects&#8230; the main requirements that I have are&#8230;</p>
<ul>
<li>Very small footprint.</li>
<li>Custom compiled kernel that has the bare essentials to support <strong>all</strong> of the hardware on the board natively, no KLM&#8217;s allowed.</li>
<li>A working shell environment, Busybox is my target at present.</li>
<li>A port of UCI which is extensively used throughout OpenWRT, that really is an awesome configuration utility.</li>
<li>A port of the LUCI framwork, again, used extensively throughout OpenWRT.
<ul>
<li>LUCI is a MVC based framework written in LUA that provides superb interaction with the UCI configuration tool.</li>
</ul>
</li>
<li>A method of automatically &#8216;provisioning&#8217; a unit with a set of configuration files
<ul>
<li>Most likely the provisioning will be handled on a back end server somewhere (read: webserver) where the unit it&#8217;s self simply checks the server on first boot and will grab the config files if they exist.</li>
</ul>
</li>
<li>Support for V4L and webcams. This provides the potential to take a cheap webcam, and a cheap board, and have a cheap IP camera.</li>
</ul>
<p>More will be added to this list as some of the items are checked off or as a need arises for them. One thing that I cant think of, and I have never been very good at it, is a <strong>name</strong> for the project. Any ideas? Please do let me know in the comments, one idea I heard was ic-linux&#8230;</p>
<p>Since committing to doing this I have built a small development area for myself using my Laptop and some other equipment I had that would be useful, USB hub, old router with DHCP disabled as I dont have a small switch, various tools, memory sticks etc&#8230; unfortunately I was doing some work on my room and ended up making a mess of it all so its not exactly picture worthy at the minute, but I will get some put up soon.</p>
<p>Anyway, thats enough rambling on for now&#8230;<img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=hackdcom-20&amp;l=as2&amp;o=1&amp;a=0131679848" border="0" alt="" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2009/11/embedded-linux-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New project&#8230;</title>
		<link>http://hackdev.com/2009/10/new-project/</link>
		<comments>http://hackdev.com/2009/10/new-project/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 20:35:03 +0000</pubDate>
		<dc:creator>Gues7</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://hackdev.com/?p=63</guid>
		<description><![CDATA[Being constant tinkerer that I am, I have a new (old) project in the pipelines! Im actually revisiting an older project of mine that fell by the way-side to make room for constant gaming and neglect of wanting to actually do anything. It all started when I ordered some books from a site that I [...]]]></description>
			<content:encoded><![CDATA[<p>Being constant tinkerer that I am, I have a new (old) project in the pipelines! Im actually revisiting an older project of mine that fell by the way-side to make room for constant gaming and neglect of wanting to actually do anything. It all started when I ordered some books from a site that I like and actually read them instead of leaving them sitting on my shelf for a change. And so it begins, in an effort to prove to myself that I can read a book and really learn from what it has to say, BuildFunStuff v2 is in the works. The project is going to consist of the following milestone goals&#8230;</p>
<ul>
<li>Designing a custom theme for wordpress that is HTML 4.01 Strict compliant.</li>
<li>Writing a full, comprehensive legal disclaimer</li>
<li>Writing an accessibility statement</li>
<li>Writing a number of fun projects you can build at home with minimal tools</li>
<li>Integrating wordpress with Google Adsense</li>
<li>Integrating wordpress with Twitter</li>
<li>Making a few short video&#8217;s to advertise the site and its projects</li>
</ul>
<p>Of course, not all of these milestones are going to be in the order they are listed in here, in fact the disclaimer has been drafted and is awaiting review. Even the accessability statement is a work in progress, of course the statement cant be finalised until the theme is comlete because who knows what type of whacky accessability stuff I&#8217;m going to integrate into it. The theme is most likely going to be based off the 160gs CSS system as I think that would be a useful learning exercise. The projects can all be done in the background as Im working on the rest of the bits and pieces, all in all at present, I&#8217;d say I have around 10% of the total work drafted&#8230; which really means around 0% of it done since its all going to have to be re-visited&#8230; but hey, you have to start somewhere dont you?</p>
<p>Anyway, thats enough jibber jabber for now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hackdev.com/2009/10/new-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
