Step 1: Design the Character Set
Letters and numbers are made visible by assigning a voltage to each dot, vertically, and using time to scan across it. If a dot is to be made visible, a particular voltage is output during its time slot. If the dot is invisible, a blanking voltage is output during that time instead.
Since we are using a programmable microcontroller, the characters to be displayed will be held as dot patterns in its program memory. We thus have the freedom to design the character set for the clock. I have used a 7x5 matrix font, and used graph paper to design the characters.
It is simple. Just grab a pen and mark inside the squares of the 7x5 area, and try to make the result look like letters and numbers.
Get lots of paper, so that you can throw away your mistakes and start all over again.
Or, you can download the data sheet of some LCD controller ic and it will have all those character maps listed inside. Copy away, and no one will ever suspect that this work is not your own.
Step 2: Digitise Each Character
A blank square is zero. A filled square is a one. One bit in each byte will remain unused.
The microchip assembler directive "dt" will cause the value following it to be converted into a "retlw" intruction.
The number in the form " b'nnnnnnn' " will be interpreted as a binary number.
In this case, I have decided to make the top of the character be represented by the most significant bit of the byte.
This process will have to be repeated for each character that you wish to display.
Step 3: The Program
I have made it in two parts: the character generator part is in a separate include file, "chargen.inc", and the main program is the file "clock510.asm". When you assemble it with MPLAB, you get the file "clock510.hex" which has to be programmed into a Microchip PIC12F510, PIC12F509 or PIC12F508. The same hex file will work for all three processors. The circuit is shown in ASCII form in the program itself.
Step 4: The Circuit
The remaining three leads connect to three resistors forming a crude weighted resistor DAC.
GPIO0 has a 47 K resistor.
GPIO1 has a 22 K resistor. This should be half the previous value, about 23.5 K, but this value is close enough.
GPIO2 has a 12 K resistor, close to the ideal value of 11K.
The other ends of the resistors are connected together, and I used a series resistor of 1 Megohm and connected it to the Line in jack of the sound card in my computer using shielded cable.
The thin wires in the picture are actually enamelled copper, and so will not short to one another if they touch. They go to a programming and power supply socket at the top of the board.
Step 5: Displaying the Clock
As shown in the screenshot, the recording control has to be used in order to select the LINE IN socket as source (or whatever else you are connecting it to).
I used a program called Free Audio Editor to capture the output of the clock and view it. As you can see, the results are not very good.
Step 6: Decode the Waveform
The problem with visibility here is that the program draws lines in between the dots, joining them. In an actual oscilloscope display, the lines between those dots will be very faint because the electron beam is travelling fast, so only the spots will be visible.
The best way of displaying the clock was that used for the introductory screenshot - using a windows based oscilloscope program which displays waveforms captured from the sound card. Just search the web for "winscope".
Or there might be some audio editing software out there that displays the waveform as scattered dots rather than jointed lines.
Step 7: Windows Based Oscilloscope
Step 8: Setting the Time
However, that one input could be used as a "fast set" input - pull that low, and the clock increments at a fast rate. Release it when the correct time is reached and the clock runs on as usual. This has not been implemented, however. At present the only way to have the clock keep correct time is to switch it on at 12 noon precisely.
The pictures show a different sort of waveform from the clock, and the changes in the program which caused these to happen.
The program files and the hex file are included as well, so that you can, if you wish to, duplicate my efforts.
And why would you want to do that?
The clock is a very compact instrument. Power it from three button cells and it can be made small enough to be worn as a ring.
The only disadvantage is the need to carry around a storage oscilloscope and its power supply in order to read the time.
Since the output is an audio waveform, this sort of coding can be used to transmit telemetry or beacon data through a voice link. But as a clock, I am afraid this gadget will rate among one of those elaborate, but completely useless, contraptions which do some commonplace thing in a roundabout way.