HC08 Fan Timer using pic microcontroller

Build a timer with Motorola Nitron MCU and using ICC08 to develop c program. Loader schematic also included. New s-record for 8-pin 68HC908QT2!
My son got his fan in the bedroom. The fan has mechanical timer for 0-180mins. One day it broken. So I got the idea to use Nitron chip to replace the mechanical timer. Someone may ask me why so complicated timer made by microcontroller chip? Actually we can build a timer with 555 and a 14-stage cmos counter! The 555 runs astable with time constant controlled by RC and for long period timing we can divide the output frequency of 555 by a cmos counter. That was my homebuilt timer 20 Yrs ago. Such circuit needs a number of passive components. We will see the hardware for timer with Motorola Nitron chip, it is only 16-pin MCU and one decoupling cap. All passive components and timing function are replaced with c coding

HC08 Fan Timer Hardware Schematic

The loader circuit is shown in the block. The hardware settings (external clock with high voltage) forces Nitron chip to run in monitor mode. The IRQ(PTA2) ties to pin 2 of MAX232 to provide HV signal. The external oscillator is required for 9600 BAUD send/receive monitor command via PTA0. It made with CMOS inverter 74HC04 and xtal 9.8304MHz. PTA1 and PTA4 also are required. The free software loader, PROG08SZ V1.7 can get from http://www.pemicro.com/.

The HC08 Fan timer circuit is shown below the loader. The Nitron chip is MC68HC908QY4, 16pin PDIP. When using the ICC08 program, you can choose the programming algorithm with QY4, say. R6 is 10k POT B type tied to the AD0, analog input channel0. It used to set time from 0Hr to 5Hrs. The output relay driving circuit is PTA3. A small NPN transistor drives a 12V electromechanical relay. D2 provides a path for back EMF current flowing when Q2 is turned off. C3 is multilayer 0.1uF decoupling cap. The Nitron chip has internal clock, power reset, low voltage detection, watchdog. You may learn more features from Niron Data sheet.

Zero Power Standby

Figure 2 shows a sample schematic featuring zero power standby. By using a push button S1 to make K1’s contact closed when S1 was pressed. The K1’s contact will close and latch with period setting by R6. When time-out the K1’s contact will open thus turns itself power off. To restart timer, just press S1 again.


As shown in the schematic, we see that the timer circuit has only one 16-pin MCU, so all timing functions are done by program.

HC08 Fan Timer

/*  timer.c firmware for cheap timer using Nitron chip
  MC908QY4CP 16-pin MCU
  compiled with icc08  Time setting is made by 10k POT, the analog input 0-5V.
  Time(mins) = (ADC reading *300)/255  Copyright (c) 2004 Wichit Sirichote, [email protected]

#include <io908QY4.H>

#define minute 7200// 120 ticks = 1 sec, so 7200 ticks = 1 minute

char count;char n,timer1;unsigned int timer2,timer3;unsigned char sec;unsigned int min, PV, save_time,set_time;char x1,x2,x3;char minute_pass;void disable_timer(){   if(set_time <5) PTA &= ~0x8; // off timer}void minute_clock(){   timer2++;   if (timer2 > minute)   {timer2 = 0;    minute_pass = 1;  }}void run_timer(){  if (timer3 > 10)  { PTA |= 0x8;// output high relay if (minute_pass == 1)    {  minute_pass = 0;
         timer3–;   }   }    else    { PTA &= ~0x8; // off relay    }


For more detail: HC08 Fan Timer

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: