The Clock Controller V1.1was designed to be an exemplary of using 'C' language to control timer0interrupt, 7-segment LED and keypad scanning. It provides 1-bit sink currentdriving output, for driving a relay, opto-triac, say. Many projects requiring7-segment display and keypad interfacing may get the idea from the Clockcircuit and software.
Hardware
Figure 1 shows a circuitdiagram of the Clock Controller V1.1. P10-P1.7 drives 7-segment commonanode LED with sink current. P3.0-P3.3 also drives a base pin of 4-PNPtransistor, 2n2907 with sink current. As shown in the figure, the 2nd 2-digitLED that connected to P3.2 and P3.3 is rotated 180 degrees to the 1st 2-digitallowing the pt. segment to be used for 1 second blinking. P3.0-P3.3 alsoconnects four momentary switches while the other legs are tied to inputport P3.4. During display and key switch scanning, a logic '0' is shiftedfrom P3.0 to P3.3, 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 a2n2907 to drive a small electromechanical relay 5V, say.
Figure 1. Circuit related |
Software
The program clock.cwas written in ‘C’ language and was complied by Micro-C Compiler from DunfiledDevelopment Systems. The memory model is TINY. The hex file of clock.csuitable for downloading by Easy-Downloaderis clock.hex.The Clock1.cwas modified for C51 compiler. The function that updates real-time clockwas moved into timer0 interrupt service routine. The HEX file is Clock1.hexsmaller than compiled by Micro-C.
I got many requests askingmodification of the source code. Now you can modify the source code byyourself with the free compiler sdcc for 8051. Here is the source codeof new firmware, clock2.c and the hex file,clock2.hex.Please test it and let me know the result. I haven't tested my hardwareyet, because I cannot find it now. This project is quite long time ago.You may add your code or modify whatever you like to have using sdcc! Youmay download the sdcc here, sdcc.zip.
Practice
The function time( ) in clock.cwas not put in the timer0 service routine, there's a bit delay at scanLED() function making the clock delay, try write a function that make adjustmentof the clock.
With C51 compiler, there's aspace for more functions to put in, write a function that saves a secondtime on and off.
Heavy Load Driving
I suggest to use a zero switchsolid-state relay for driving heavy loads (>10A). Most solid state relay'sinput can be driven with 3-30Vdc without any problems.Contribution to Clock Controller Project
- Sridhar Vittalrao designed the PCB layout (Protel), Clock.zip
- Petar Timotijevic Pancevo, Serbia made the single sided PCB in Cadsoft Eagle for Clock Controller Ver. 1.1. The clock controller has two PCB. The first board is main circuit and the second board is display module. Connection between them is made with ribbon cable. This makes easier to implement display in the right angle. More detailed in the compressed file, i.e. Eagle3D view of boards, specification, compiler instructions, and PCB print data information. Petar has modified some part based on the original circuit: Transformer and the output are implemented, i.e. selectable 220V or 110V. The output is optocoupler with manual on/off, and switch for pin11 output, relay on 12V with signal led diode, 78S05 is used instead of 78L05 (100mA), 7812 if needed, standard 7-seg display connection. PCB and circuit have been tested. Click here to download it, PCB V1.1.RAR
- Petar Timotijevic describes how to modify the time schedule in the HEX code using the freeware HEX EDITOR directly. This eliminates the need of recompilation. Click here for the explanation,Modify Time Schedule with HEX Editor
No comments:
Post a Comment