Countdown Timer Using LCD
A countdown timer is a down counter that counts from
a specified time to zero. It is used in many devices such as washing machine,
televisions, microwave ovens, etc. This countdown timer has three states: the
running state where it counts down, the pause state where it displays the
paused time and the reset state to set the countdown.
I have developed this count down timer as part of my another project.This count down timer count from 99 to zero. This can be used as count down timer in hours or minutes or seconds by adjusting the delay value.For count down in minutes delay value will be 6000.Also the maximum value of count down can be change in program.The reset switch will reset the count down timer.Main parts of the project are microcontroller AT89C51and LCD,5v Regulated power supply.
Microcontroller AT89C51:
Microcontroller AT89C51 is at the heart of the
circuit. It is a low power, high performance, 8-bit microcontroller with 4 kB
of flash programmable and erasable read-only memory (PEROM) used as on-chip
program memory, 128 bytes of RAM used as internal data memory, 32 individually programmable
input/output (I/O) lines divided into four 8-bit ports, two 16-bit programmable
timers/counters, a five-vector two-level interrupt architecture, on-chip
oscillator and clock circuitry. A 11.0592MHz crystal (XTAL1) is used to provide
basic clock frequency for the microcontroller. Capacitor C3 and resistor R3
form the power-on reset circuit, while push-to-on switch S20 is used for manual
reset.
Liquid
Crystal Display (LCD):
Liquid crystal display a
type of display used in digital watches and many portable computers.LCD
displays utilize two sheets of polarizing material with a liquid crystal
solution between them. An electric current passed through the liquid causes the
crystals to align so that light cannot pass through them. Each crystal,
therefore, is like a shutter, either allowing light to pass through or blocking
the light.
The liquid crystals can be manipulated through an
applied electric voltage so that light is allowed to pass or is blocked. By
carefully controlling where and what wavelength (color) of light is allowed to
pass, the LCD monitor is able to display images. A back light provides LCD
monitor’s brightness.Other advances have allowed LCD’s to greatly reduce
liquid crystal cell response times. Response time is basically the amount of
time it takes for a pixel to “change colors”. In reality response time is the
amount of time it takes a liquid crystal cell to go from being active to
inactive. Here the LCD is used at both the Transmitter as well as the receiver
side. The input which we give to the microcontroller is displayed on the LCD of
the transmitter side and the message sent is received at the receiver side
which displays at the receiver end of the LCD and the corresponding operation
is performed.
They make complicated equipment easier to operate.
LCDs come in many shapes and sizes but the most common is the 16 character x 4
line display with no backlight. It requires only 11 connections – eight bits
for data (which can be reduced to four if necessary) and three control lines
(we have only used two here). It runs off a 5V DC supply and only needs about
1mA of current. The display contrast can be varied by changing the voltage into
pin 3 of the display.
Power Supply Unit
The power supply unit is used to provide constant 5
V dc supply to the peripherals. The 230 V ac is converted into 9 V ac by using
a transformer and then a bridge rectifier rectifies it to a 9 V dc with ac
ripples. This is then filtered by electrolytic capacitors used across the
rectifier output. LM7805 regulator is employed to obtain a constant 5 V dc at
the output.
Count Down Timer Using LCD Program
#include<reg51.h>
#define cmdport P3
#define dataport P2
sbit rs = cmdport^0;
//register select pin
sbit rw = cmdport^1;
// read write pin
sbit e = cmdport^6;
//enable pin
void delay(unsigned int msec) // Function to provide time delay in msec.
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcdcmd(unsigned char item) //Function to send command to LCD
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
}
void lcddata(unsigned char disp) //Function to send data to LCD
{
dataport = disp;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
}
void main()
{
while(1)
{
unsigned
int i,s,test_final;
lcdcmd(0x38); // for using 8-bit
2 row mode of LCD
delay(100);
lcdcmd(0x0E); // turn display ON
for cursor blinking
delay(100);
lcdcmd(0x80);
delay(25);
for(i=99;i>0;i--)
{
lcdcmd(0x01);
test_final=i;
s=test_final/100;
test_final=test_final%100;
if(s!=0)
{
lcddata(s+48);
delay(250);
}
else
{
s=test_final/10;
test_final=test_final%10;
lcddata(s+48);
lcddata(test_final+48);
lcddata(0);
delay(250);
}
}
}
}
No comments:
Post a Comment