But, having finally finished our custom alarm clocks project, and waved family farefare for another Christmas, we eventually found time to get the soldering iron out and write some PIC micro code.
The first thing to do is confirm that we're able to correctly address each column in an 8x16 matrix. If we can't do that properly, debugging in future is going to be a nightmare. So we put together a simple routine which lights up a sequence of on-off-on-off LEDs on each column, and had the PIC light each column in turn (in time we'll just speed this up and use persistance-of-vision to make each individual LED look like it's continuously lit up).
Once we were happy that we could address each column and send it a single byte figure to get different LEDs to light up, we hacked together some code to make the "correct" LEDs light up, according to the current time. We've discussed the method on how to do this in an earlier post.
And the code is starting to look good. So far, we've got our clock lighting up the correct LEDs! Here are some examples of hard-coded times and the resulting LED output:
(it has just gone twenty minutes past eight)
(it is twenty five past seven)
(it is nearly ten o'clock)
Compared to the word grid, everything appears to line up correctly for the random sample times we've chosen:
We're currently using the 20Mhz operational clock crystal for our time-base, and an internal counter to keep track of the milliseconds and seconds. We'll have to leave the "clock" running for quite some time to see what kind of drift we get, and how accurate the clock stays to the true time.
(we're hoping that any drift will be disguised long enough to be un-noticeable, since the clock is only actually accurate to about two minutes anyway!)
All that remains now is to fire up the laser-cutter and make a nice fancy etched front for it....