Home » Microcontrollers » Clock Controller V1.1 Review
Jul
07
 

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.

Hardware

Clock Controller V1.1 Review

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.
Hardware

Figure 1 shows 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 switches 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,  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: Schematic 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.

The Clock1.c was modified for C51 compiler. The function that updates real-time clock was moved into timer0 interrupt service routine. The HEX file is Clock1.hex smaller than compiled by Micro-C. 
I got many requests asking modification of the source code. Now you can modify the source code by yourself with the free compiler sdcc for 8051. Here is the source code of new firmware, clock2.c and the hex file, clock2.hex. Please test it and let me know the result. I havent tested my hardware yet, 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! You may download the sdcc here, sdcc.zip.

Practice

  • The function time( ) in clock.c was not put in the timer0 service routine, theres a bit delay at scanLED( ) function making the clock delay, try write a function that make adjustment of the clock.
  • With C51 compiler, theres a space for more functions to put in, write a function that saves a second time on and off.
  • Heavy Load Driving

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

    Contribution to Clock Controller Project

    Clock Controller V2.0

    One day I found a small 7-segment LED with multiplex connection. It is nice to be used as the display for clock controller. So I spent my weekend built the board. Below are the pictures for outlook and internal. The board is quite small. The output has small relay for 0.5A AC load.  
     
    This version has only three buttons. We can set current hour and min easily. The preset time on/off for relay control output are defined in the program. 
    // preset set time on/off are predefined in rom, user may change it here 
    #define onHour1 19
    #define onMin1 00
    #define offHour1 21
    #define offMin1 30
     
    Also if you need more period to turn on/off you can add, say onHour2, onMin2, offHour2, and offMin2. And provide the function that compares such period. It will be the same as function comparetime. Or you may insert at if statements. When reset, the board will turn output off, until user set current time, the clock will run again. This prevent improper output firing.
     
    void comparetime()
    {
    if(flag1 & 0×40) // compare time only when user enter new time
    {
    if(flag1 & 0×01)
    {
    flag1 &= ~0×01;
    if(hour == onHour1 && min == onMin1)
    opto = 0x7f; /* clear P3.7 turning opto on */
    if(hour == offHour1 && min == offMin1)
    opto = 0xff; /* set bit P3.7 turning opto off */
    }
    }
    }

     

      

    Download

    Schematic clock2.pdf
    Source Code clock3.c
    HEX file RTC3.HEX

    Share and Enjoy:
    • Print
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Mixx
    • Google Bookmarks

    Related posts:

    1. Build Your Own Microcontroller ProjectsWHATs NEW  Data Acquisition using ATmega8   Build the AVR ADC board and PC software for temperature logging. Solar Server   Build the solar station for insolation measurement with Ubuntu server 7.10 and a 24-bit Delta-sigma converter. Single-Side PCB for Easy-Downloader V1.1  Easy build and small size single side PCB for the 2051 programmer board. Tiny2313 Development Board  Easy [...]...
    2. Asus Maximus II Formula Intel P45 Motherboard ReviewAt first glance, Intels technical documentation for the new P45 / G45 Express series chipsets, youll note looks alarmingly similar to the previous generation P35 / G35 Express series that this new lineup of chipsets is meant to replace. As the P35 series was a rather successful architecture, this immediately struck us on a positive first note about the P45. The more [...]...
    3. INTRODUCTION TO MICROCONTROLLERSWhat are microcontrollers? They are what their name suggests. Today they can be found in almost any complex electronic device – from portable music devices to washing machines to your car. They are programmable, cheap, small, can handle abuse, require almost zero power, and there are so many variaties to suit every need. This is [...]...
    4. AVRISP mkII USB Programmer reviewIntroduction AVR® In-System Programmer mkII is used for field upgrades of AVR Flash microcontrollers. The AVRISP mkII combined with AVR Studio® can program all AVR® 8-bit RISC microcontrollers with ISP Interface. Specifications AVR Studio compatible (AVR Studio 4.12 or later) Supports all AVR devices with ISP interface Programs both flash and EEPROM Supports fuses and [...]...
    5. AVRISP mkII USB Programmer reviewIntroduction AVR® In-System Programmer mkII is used for field upgrades of AVR Flash microcontrollers. The AVRISP mkII combined with AVR Studio® can program all AVR® 8-bit RISC microcontrollers with ISP Interface. Specifications AVR Studio compatible (AVR Studio 4.12 or later) Supports all AVR devices with ISP interface Programs both flash and EEPROM Supports fuses and [...]...
    6. Controller Area Network (CAN)Controller Area Network (CAN) [What is the endianness of CAN ? ]"CAN we talk? : Distributed systems require protocols for communication between devices. CAN and SPI are two of the most common." article by Niall Murphy 2003-05-14 http://www.embedded.com/story/OEG20030509S0042 ...
    7. AI Problems ReviewAnimals have a uniform, closed architecture. The human brain is an open platform; people get by using a wide variety of techniques called “professions”. The flexibility has its drawbacks. We aren’t tuned for any particular profession, and apparently that’s why everybody develops some sort of profession-related problems. Proctologists reportedly turn rude as time goes by. [...]...
    8. Nokia N82 ReviewIn a nutshell: A good alternative to the N95, the N81 offers very nearly the same features, but at a significantly lower price. Its a classic-style smartphone with GPS navigation, an outstanding 5 megapixel camera, media player, wireless LAN, a 2 Gbyte memory card and HSDPA for accelerated 3G connectivity. The Nokia N95 has been [...]...
    9. UPS With Digital LCD UPS – 500DDetailed UPS With Digital LCD UPS – 500D Description Primary Technical Parameter Rated voltage: AC 220V Rated frequency: 50Hz / 60HzAInput range: AC 165V~275V Output voltage: AC 220V~10% Transfer time: 4ms Battery type: 12V / 7AH / 1PC () Back – up time: Over 15 minutes if use for one PC with a 17monitor (); [...]...

    88 views

    Add reply

     3000 characters available