Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
11Activity
0 of .
Results for:
No results containing your search query
P. 1
Digital alarm clock using 89S51 microcontroller

Digital alarm clock using 89S51 microcontroller

Ratings: (0)|Views: 5,232|Likes:
Published by Vishal Kottarathil

More info:

Published by: Vishal Kottarathil on Apr 15, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

05/19/2013

pdf

text

original

 
//Programtoma
 
eadigitalcloc
 
withtimeandalaramsettingfunction#include<reg51.h>#defineportP1#definecont_portP3#definedataportP2//DataportforLCD#definem_sec10sbitrs=cont_port^0;sbitrw=cont_port^1;sbiten=cont_port^6;sbitdig_hr1=port^0;sbitdig_min1=port^1;sbitstart=port^2;sbitam_pm=port^3;sbitalarm_set=port^4;sbitalarm=port^7;inthr,hr1=0,alarm_hr=0;intmin,min1=0,alarm_min=0;intsec,sec1=0,dig_am_pm=0,alarm_am_pm=0;voiddelay(unsignedintmsec)//Timedelayfunction{inti,j;for(i=0;i<msec;i++)for(j=0;j<1275;j++);}voidlcd_cmd(unsignedcharitem)//FunctiontosendcommandtoLCD{dataport=item;rs=0;rw=0;en=1;delay(1);en=0;return;}voidlcd_data(unsignedcharitem)//FunctiontosenddatatoLCD{dataport=item;rs=1;rw=0;en=1;delay(1);en=0;return;}voidlcd_data_string(unsignedchar*str)//FunctiontosendstringtoLCD{inti=0;while(str[i]!='\0'){lcd_data(str[i]);i++;delay(1);}return;
 
}lcd_data_int(inttime_val)//FunctiontosendnumbertoLCD{intint_amt;int_amt=time_val/10;lcd_data(int_amt+48);int_amt=time_val%10;lcd_data(int_amt+48);}voidlcd(unsignedcharstr1[10]){lcd_cmd(0x38);lcd_cmd(0x0e);delay(1);lcd_data_string(str1);}voidset_hr1()////Functiontosethoursdigitofcloc
 
{delay(15);hr1++;if(hr1>11)hr1=0;lcd_cmd(0xc3);lcd_data_int(hr1);lcd_data(':');}voidset_min1()//Functiontosetminutesdigitofcloc
 
{delay(10);min1++;if(min1>59)min1=0;lcd_cmd(0xc6);lcd_data_int(min1);}voidset_alarm_hr1()//Functiontosethoursdigitofalarm{delay(15);alarm_hr++;if(alarm_hr>11)alarm_hr=0;lcd_cmd(0xc3);lcd_data_int(alarm_hr);lcd_data(':');}voidset_alarm_min1()//FunctiontosetminutesdigitofAlarm{delay(15);alarm_min++;if(alarm_min>59)alarm_min=0;lcd_cmd(0xc6);lcd_data_int(alarm_min);}
 
voidalarm_chec
 
()//Functiontochec
 
alarm{if(hr==alarm_hr){if(min==alarm_min){if(dig_am_pm==alarm_am_pm){alarm=1;lcd_cmd(0xc5);lcd("ALARM");delay(10);alarm=0;}}}}voidmain(){int
 
;start=1;dig_hr1=1;dig_min1=1;alarm_set=1;alarm=1;lcd_cmd(0x83);lcd("SETALARM");lcd_cmd(0xc3);lcd_data_int(hr1);lcd_data(':');lcd_data_int(min1);alarm=0;while(alarm_set==0){delay(25);if(dig_hr1==0)set_alarm_hr1();if(dig_min1==0)set_alarm_min1();}if(am_pm==0){lcd_cmd(0xc8);lcd_data_string("am");alarm_am_pm=0;}if(am_pm==1){lcd_cmd(0xc8);lcd_data_string("pm");alarm_am_pm=1;}delay(200);lcd_cmd(0x01);lcd_cmd(0x83);

Activity (11)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Azizul Asri liked this
Vikas Theetha liked this
kalange liked this
Yesh Hsey liked this
katsuaki13 liked this
Mhammad Mo'en liked this
seyki657735 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->