Clock Controller V1.1

Wichit Sirichote, kswichit@kmitl.ac.th

Build a digital clock that turns AC load on/off with preset time.


Introduction

The Clock Controller V1.1 was designed to be an exemplary of using 'C' language to control timer0 interrupt, 7-segment LED and keypad scanning.It provides 1-bit sink current driving output, for driving a relay, opto-triac, say. Many projects requiring 7-segment display and keypad interfacing may get the idea from the Clock circuit and software.

Circuit Description

Figure 1 depicts a circuit diagram of the Clock Controller V1.1. P10-P1.7 drives 7-segment common anode LED with sink current. P3.0-P3.3 also drives a base pin of 4-PNP transistor, 2n2907 with sink current. As shown in the figure, the 2nd 2-digit LED that connected to P3.2 and P3.3 is rotated 180 degrees to the 1st 2-digit allowing the pt. segment to be used for 1 second blinking. P3.0-P3.3 also connects four momentary switchs while the other legs are tied to input port P3.4. During display and key switch scanning, a logic '0' is shifted from P3.0 to P3.3 every 10ms, if there was a key pressed, P3.4 then became low. P3.7 is a 1-bit sink current driving, an example in the circuit uses a 2n2907 to drive a small electromechanical relay 5V, say.

Figure 1: Circuit Diagram of the Clock V1.1

Software

The program clock.c was written in ‘C’ language and was complied by Micro-C Compiler from Dunfiled Development Systems. The memory model is TINY. The hex file of clock.c suitable for downloading by Easy-Downloader is clock.hex.

Heavy Load Driving

I suggest to use a zero switch solid-state relay for driving heavy loads (>10A). Most solid state relays's input can be drived with 3-30Vdc without any problems.


Last updated, 10 May 2542