Saturday, 3 March 2012

32. PIC Clock - Tic 2

I wanted to see how far I could push the clock idea by adding two more dual 7 segment displays to add seconds and information. This meant controlling 8 transistors, however with all pins on the PIC16F505 used up from the last version I had to come up with a way to control 8 digits from 4 pins. Well as it happens, using binary, 3 pins are enough to control 8 outputs. Binary 000 to 111 is 8 different values.

Now as luck would have it, there is such a thing as an 8 bit decoder controlled by 3 inputs in the guise of a 74LS238. There are many manufacturers and I used an M74HC238B1 from ST Microelectronics. Its does exactly the same thing.

Using 1 less pin to control the 8 digits means I have a pin left over. This gives me an extra button to control the functions of the clock. I have yet to program these in but the its all wired up ready. All you can do is increase the minutes as before. The day was hardcoded so it always says SA for Saturday.

I programmed in the entire alphabet (well as best you can with a 7 segment display as M,W,K,Q and X are not ideal) and this means I can display the day (Mo, Tu, We etc.), mode (AL for alarm, Yr for year etc.) amongst other uses I have yet to conjour.

Here is it displaying Saturday 10:39 and 41 seconds.


With the additional displays there is a noticeable flicker as each one is updated and this is because the delay between refreshing each digit has doubled from 4x4ms to 8x4ms. I've not addressed this as its not that bad. Using a faster external oscillator is one option but all pins on the PIC are used so the alternatives are to halve the prescaler for TMR0 or use a different PIC with a faster internal oscillator.