Step 1: Design the character set
On an oscilloscope screen, vertical axis (up and down) corresponds to the magnitude of the voltage and horizontal axis (across) corresponds to time.
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 7×5 matrix font, and used graph paper to design the characters.
It is simple. Just grab a pen and mark inside the squares of the 7×5 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
Now you have to convert each character into numbers to be incorporated into the microcontroller program. Each byte holds eight bits, so five bytes will hold one 7×5 matrix character as ones and zeroes.
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 circuit is very simple. The eight pin microcontroller was mounted on a piece of scrap copper clad board after cutting out eight islands for the eight leads. An electrolytic capacitor was connected across the supply leads. A crystal taken from an old watch was fitted across leads 2 & 3. Two 15 pf capacitors are also to be fitted, but mine seems to work without it. Your Mileage May Vary. The MCLR/Vpp lead was pulled up to Vdd with a 10K resistor.
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
For more detail: Oscilloscope clock