Podium Timer

Posted: February 16, 2012 in Microcontroller Project
Tags: ,

The podium timer is designed for giving the indication of timeout for a series of timed speeches. The 4 × 4 hex keyboard enables the user to set the time and start the timer. Once the timer is ON, it constantly indicates the time on the LCD. Before 3 minutes (which is also programmable) of actual timeout, it gives an indication by means of short beep. As soon as the time set is elapsed, the unit enables the buzzer indicating the timeout.

podium timer

podium timer

Program Source Code
*********************************************************
#include <REG52.H> /∗ special function register declarations ∗/
/∗ for the intended 8051 derivative ∗/
sbit RS = P2∧0;
sbit RW = P2∧1;
sbit EL = P2∧2;
sbit buzz = P2∧3;
sbit R1 = P3∧0;
sbit R2 = P3∧1;
sbit R3 = P3∧2;
sbit R4 = P3∧3;
sbit C1 = P3∧4;
sbit C2 = P3∧5;
sbit C3 = P3∧6;

sbit C4 = P3∧7;
void Delay(int);
void INIT(void);
void ENABLE(void);
void LINE(int);
int keyb(void);
void settime(void);
void starttimer(void);
void check timeout(int);
int settime1=10;
void settime(void)
{
int ten pos=0, unit pos=0;
while(!(ten pos=keyb()));
while(!(unit pos=keyb()));
P1=(((ten pos))+0x30);
ENABLE();
P1=((unit pos)+0x30);
ENABLE();
Delay(2000);
settime1= ten pos∗10 + unit pos;
}
void starttimer()
{int set temp= settime;
check timeout(3); //check for the warning timeout default 3 min before
end time
check timeout(set temp);
set temp–;
P1=(((set temp)/10)+0x30);
ENABLE();
P1=((set temp/10)%10+0x30);
ENABLE();

Delay(2000);
}
void check timeout(g)
{if(g == 3)
{buzz=1;
Delay(100);
buzz=0;
}if (g == 0)
buzz=1;
Delay(400);
buzz=0;
}void main(void)
{ char test[]=“Podium timer”;
char code set msg[]=“1-> set time”;
char code start msg[]=“2-> start timer”;
char ∗p;
int j;
INIT();
LINE(1);
p=&test;
for(j=0;j<17;j++)
{if(j==0)LINE(1);
if(j==8)LINE(2);
P1= ∗p++;
ENABLE();
Delay(200);
}while(1){
RS = 1;
p=&set msg;
for(j=0;j<17;j++)
{

if(j==0)LINE(1);
if(j==8)LINE(2);
P1= ∗p++;
ENABLE();
Delay(200);
}
RS = 1;
p=&start msg;
for(j=0;j<17;j++)
{if(j==0)LINE(1);
if(j==8)LINE(2);
P1= ∗p++;
ENABLE();
Delay(200);
}
j=0;
j=keyb();
if(j>0);
if(j==1){ settime();
}if(j==2){
starttimer();
}}}
void Delay(int k)
{int i,j;
for (j=0;j<k+1;j++){ for (i=0;i<100;i++);
}}
void ENABLE(void)
{EL=1;
Delay(1);

EL=0;
Delay(1);
}void LINE(int i){ if (i==1) { RS=0;
RW=0;
P1=0x80;
ENABLE();
RS=1;
}else
{RS=0;
RW=0;
P1=0xC0;
ENABLE();
RS=1;
}
}void INIT(void) // Initialization of the LCD by giving the proper
commands.
{ RS=0;
RW=0;
EL=0;
P1 = 0x38; // 2 lines and 5∗7 matrix LCD.
ENABLE();
ENABLE();
ENABLE();
ENABLE();
P1 = 0x06; //Shift cursor to left
ENABLE();
P1 = 0x0E; // Display ON, Cursor Blinking
ENABLE();
P1 = 0x01; // Clear display Screen.
ENABLE();
}
int keyb(void){ int key=0;
C1=1;

C2=1;C3=1;C4=1;R1=0;R2=1;R3=1;R4=1;
if (C1==0) key = 1;
if (C2==0) key = 2;
if (C3==0) key = 3;
if (C4==0) key = 4;
return(key);
}
*********************************************************
Figure 6.1 Circuit diagram of the podium timer
6.2 Application

Leave a comment