Microcontroller › 8051 › Need help with LCD based alrm clock with digital thermometer
- This topic has 5 replies, 3 voices, and was last updated 11 years ago by Mukaram Jawaid.
-
AuthorPosts
-
September 2, 2013 at 4:08 pm #2617Jasper NunisaParticipant
I have problem in executing the following part of the program code. Could anyone tell me what the error is and suggest a solution?? The alarm function doesnt work at all. And in the timing function, only the dig_hr and dig_min buttons work.
“
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);
}”The full program is:
// Program to make a digital clock with integrated Alarm and digital thermometer
#include<reg51.h>
#define port P1
#define adc_input P0
#define cont_port P3
#define dataport P2
#define m_sec 10
sbit 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;
sbit wr= P3^2;
sbit rd= P3^3;
sbit intr= P3^4;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;
int test_final=0,test_intermediate1[10],test_intermediate2[3]={0,0,0};void delay(unsigned int msec) // Time dealy 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!=’