Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[51] inappropriate op of lm35 after passing through adc0804! help!

Status
Not open for further replies.

darkfall94

Newbie level 6
Joined
Nov 8, 2014
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
126
hello,
my project is 'LCD based digital alarm clock with digital thermometer using 8051 microcontroller (AT89C51)'.
here is my circuit with the o/p:

Capture.jpg

and here's the code:
Code:
// 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[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 shape()  // Function to create the shape of degree
{
lcd_cmd(64);
lcd_data(2);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
}

void convert()  // Function to convert the data of ADC
{
int s;
s=test_final/100;
test_final=test_final%100;
lcd_cmd(0xc9);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=test_final/10;
test_final=test_final%10;
lcd_data(s+48);
lcd_data(test_final+48);
lcd_data(0);
lcd_data('C');
lcd_data(' ');
delay(2);
}

void set_hr1()  // Function to set set hours digit of clock
{
hr1++;
if(hr1>11)
hr1=0;
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
}

void set_min1()  // Function to set set minutes digit of clock
{
min1++;
if(min1>59)
min1=0;
lcd_cmd(0xc6);
lcd_data_int(min1);
}

void set_alarm_hr1() // Function to set set hours digit of alarm
{
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 set minutes digit of clock
{
alarm_min++;
if(alarm_min>59)
alarm_min=0;
lcd_cmd(0xc6);
lcd_data_int(alarm_min);
}

void alarm_check()  // Function to check alarm
{
if(hr==alarm_hr)
{
  if(min==alarm_min)
  {
   if(dig_am_pm==alarm_am_pm)
   {
    alarm=1;
    lcd_cmd(0x8b);
    lcd("ALARM");
   }
  }
} 
}

void temp() // Function to calculate temperature
{
int i;
for(i=0;i<10;i++)
{
  delay(1);
  rd=1;
  wr=0;
  delay(1);
  wr=1;
  while(intr==1);
  rd=0;
  lcd_cmd(0x88);
  test_intermediate1[i]=adc_input/10;
  delay(1);
  intr=1;
}
for(i=0;i<10;i++)
test_intermediate2[0]=test_intermediate1[i]+test_intermediate2[0];

for(i=0;i<10;i++)
{
  delay(1);
  rd=1;
  wr=0;
  delay(1);
  wr=1;
  while(intr==1);
  rd=0;
  lcd_cmd(0x88);
  test_intermediate1[i]=adc_input/10;
  delay(1);
  intr=1;
}
for(i=0;i<10;i++)
test_intermediate2[1]=test_intermediate1[i]+test_intermediate2[1];

for(i=0;i<10;i++)
{
  delay(1);
  rd=1;
  wr=0;
  delay(1);
  wr=1;
  while(intr==1);
  rd=0;
  lcd_cmd(0x88);
  test_intermediate1[i]=adc_input/10;
  delay(1);
  intr=1;
}
for(i=0;i<10;i++)
test_intermediate2[2]=test_intermediate1[i]+test_intermediate2[2];

test_intermediate2[0]=test_intermediate2[0]/3;
test_intermediate2[1]=test_intermediate2[1]/3;
test_intermediate2[2]=test_intermediate2[2]/3;
test_final=test_intermediate2[0]+test_intermediate2[1]+test_intermediate2[2];
shape();
convert();
}

void main()
{
int k;
start=1;
dig_hr1=1;
dig_min1=1;
alarm_set=1;
alarm=0;

lcd_cmd(0x83);
lcd("SET ALARM");
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(alarm_set==0)
{
  delay(10);
  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");
  }
	else
	{
  lcd_cmd(0xc8);
  lcd_data_string("pm");
  }	
}
delay(200);
lcd_cmd(0x01);
lcd_cmd(0x83);
lcd("SET TIMING");
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(start==0)
{
  delay(10);
  if(dig_hr1==0)
  set_hr1();
  if(dig_min1==0)
  set_min1(); 
	if(am_pm==0)
	{
  lcd_cmd(0xc8);
  lcd_data_string("am");
  }
	else
	{
  lcd_cmd(0xc8);
  lcd_data_string("pm");
  }
}
delay(200);
lcd_cmd(0x01);
while(1)
{
	for(k=0;k<2;k++)
  {
   for(hr=hr1;hr<12;hr++)
   {
    for(min=min1;min<60;min++)
    {
     for(sec=0;sec<60;sec++)
     {
			 if(start==0)
				 goto here;
			lcd_cmd(0x81);
      delay(1);
      lcd_data_int(hr);
      lcd_data(':');
      lcd_data_int(min);
      lcd_data(':');
      lcd_data_int(sec);
      if(dig_am_pm==0)
      {
       lcd("am");
      }
      else
      {
       lcd("pm");
      }
      alarm_check();
      lcd_cmd(0xc3); 
      delay(2);
      lcd_data_string("TEMP:");
      temp();
      lcd_data_string("    ");
     }
    }
   min1=0;
   }
  if(dig_am_pm==0)
  dig_am_pm=1;
  else
  dig_am_pm=0;
  hr1=0;
  }
}
here:
{
	while(1)
	lcd_cmd(0x01);
}
}


The digital alarm clock seems to be working fine...but the temperature value is bizarre.
the temp fed into lm35 is 29 degree celsius but as u can see o/p on lcd is 12 degree celsius.
Can any1 tell me what went wrong?
 
Last edited by a moderator:

Check 8051 projects at saeedsolutions.blogspot.com

I think they have ADC0804 and RTC DS1307 projects. Just take the code and combine them.
 
This code detail is ultimately ruining the already low resolution of ADC804. Reconsider!
Code:
xxx = adc_input/10;
 

thank you for the link.
i changed my circuit and interfaced adc 0808 with lm35.
but i get the following errors while compiling with keil uvision:
compiling clock1.c...
clock1.c(159): warning C206: 'InitADC': missing function-prototype
clock1.c(160): warning C206: 'ReadADC': missing function-prototype
clock1.c(160): error C267: 'ReadADC': requires ANSI-style prototype
clock1.c(173): error C231: 'InitADC': redefinition
clock1.c(184): error C231: 'InitADC': redefinition
clock1.c(186): error C141: syntax error near '0'
clock1.c(187): error C231: 'ReadADC': redefinition
clock1.c(243): error C231: 'ReadADC': redefinition
Target not created.

i tried googling but in vain...plz someonehelp me out!!
here the schematic:
Capture.JPG

and the modified code:
Code:
				// Program to make a digital clock with integrated Alarm and digital thermometer
				#include<reg51.h>
				#define port P1
				#define Data_Bus P0
				#define cont_port P3
				#define dataport P2
				#define HalfCycleDelay 10
				#define AN0	0

				sbit rs = port^5;
				sbit rw = port^6;
				sbit en = port^7;
				sbit dig_hr1=port^0;
				sbit dig_min1=port^1;
				sbit start1=port^2;
				sbit am_pm=port^3;
				sbit alarm_set=port^4;
				sbit Add_A=cont_port^0;
				sbit Add_B=cont_port^1;
				sbit Add_C=cont_port^2;
				sbit ALE=cont_port^3;
				sbit EOC=cont_port^6;
				sbit OE=cont_port^7;
				sbit START=cont_port^5;
				sbit CLK=cont_port^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;

				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[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 shape()  // Function to create the shape of degree
				{
				lcd_cmd(64);
				lcd_data(2);
				lcd_data(5);
				lcd_data(2);
				lcd_data(0);
				lcd_data(0);
				lcd_data(0);
				lcd_data(0);
				lcd_data(0);
				}

				void set_hr1()  // Function to set set hours digit of clock
				{
				hr1++;
				if(hr1>11)
				hr1=0;
				lcd_cmd(0xc3);
				lcd_data_int(hr1);
				lcd_data(':');
				}

				void set_min1()  // Function to set set minutes digit of clock
				{
				min1++;
				if(min1>59)
				min1=0;
				lcd_cmd(0xc6);
				lcd_data_int(min1);
				}

				void set_alarm_hr1() // Function to set set hours digit of alarm
				{
				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 set minutes digit of clock
				{
				alarm_min++;
				if(alarm_min>59)
				alarm_min=0;
				lcd_cmd(0xc6);
				lcd_data_int(alarm_min);
				}

				void alarm_check()  // Function to check alarm
				{
				if(hr==alarm_hr)
				{
					if(min==alarm_min)
					{
					 if(dig_am_pm==alarm_am_pm)
					 {
						lcd_cmd(0x8b);
						lcd("ALARM");
					 }
					}
				} 
				}

				void temp() // Function to calculate temperature
				{
					unsigned char ADC_Value = 0;	 	// To capture ADC value
					unsigned char Digit[3] = { 0,0,0 };	// To make digits to display on LCD
					InitADC();							// Initialize ADC
					ADC_Value = ReadADC(AN0);		// Read ADC value from Channel 1

					Digit[2] = (unsigned char)(	ADC_Value/100);		  			// Find out first digit
					Digit[1] = (unsigned char)( ADC_Value/10) - Digit[2]*10;	// Find out second digit
					lcd_cmd(0x88);
					lcd_data_int(Digit[2]);								// Display first digit
					lcd_data_int(Digit[1]);								// Display second digit
					delay(1);												 
					shape();
					lcd_data_string("C");
					}

				void InitADC(void)
				{
					Add_A = 0;		  // Make output
					Add_B = 0;		  // Make output 
					Add_C = 0;		  // Make output
					ALE   = 0;		  // Make output
					EOC   = 1;		  // Make input
					OE    = 0;		  // Make output
					START = 0;		  // Make output
					CLK   = 0;		  // Make output
					
					Data_Bus = 0xFF;  // Make Inputs	
				}

					unsigned char ReadADC(unsigned char AN0)			
					{
					unsigned int i = 0;
					unsigned int ADC_value = 0;

					Add_C = 0;
					Add_B = 0;
					Add_A = 0;
					
					delay(HalfCycleDelay);		// 250kHz Frequency
					ALE = 1;						// Enable Address Latch
					CLK = 1; 						// Make CLK High
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 0; 						// Make CLK Low
					START = 1;						// Start ADC Conversion
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 1; 						// Make CLK High
					ALE = 0;						// Disable Address Latch
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 0; 						// Make CLK Low
					START = 0;						// Complete the start pulse

					for(i=0;i<2000;i++)
					{
						CLK = !CLK;					// Toggle Clock
						delay(HalfCycleDelay);	// 250kHz Frequency

						if(!EOC)		  			// Wait for EOC to be low
							break;
					}

					for(i=0;i<2000;i++)
					{
						CLK = !CLK;					// Toggle Clock
						delay(HalfCycleDelay);	// 250kHz Frequency

						if(EOC)					   	// Wait for EOC to be High	
							break;
					}

					CLK = 0; 						// Make CLK Low
					OE = 1;							// Enable Output
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 1; 						// Make CLK High
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 0; 						// Make CLK Low
					delay(HalfCycleDelay);		// 250kHz Frequency
					CLK = 1; 						// Make CLK High

					ADC_value = Data_Bus;			// Read value

					delay(HalfCycleDelay);		// 250kHz Frequency
					OE = 0;							// Disable Output
					CLK = 0; 						// Make CLK Low
					delay(HalfCycleDelay);		// 250kHz Frequency

					return ADC_value;		 		// Return ADC value
				}

				void main()
				{
				int k;
				start1=1;
				dig_hr1=1;
				dig_min1=1;
				alarm_set=1;
					
				lcd_cmd(0x83);
				lcd("SET ALARM");
				lcd_cmd(0xc3);
				lcd_data_int(hr1);
				lcd_data(':');
				lcd_data_int(min1);
				while(alarm_set==0)
				{
					delay(10);
					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");
					}
					else
					{
					lcd_cmd(0xc8);
					lcd_data_string("pm");
					}	
				}
				delay(200);
				lcd_cmd(0x01);
				lcd_cmd(0x83);
				lcd("SET TIMING");
				lcd_cmd(0xc3);
				lcd_data_int(hr1);
				lcd_data(':');
				lcd_data_int(min1);
				while(start1==0)
				{
					delay(10);
					if(dig_hr1==0)
					set_hr1();
					if(dig_min1==0)
					set_min1(); 
					if(am_pm==0)
					{
					lcd_cmd(0xc8);
					lcd_data_string("am");
					}
					else
					{
					lcd_cmd(0xc8);
					lcd_data_string("pm");
					}
				}
				delay(200);
				lcd_cmd(0x01);
				while(1)
				{
					for(k=0;k<2;k++)
					{
					 for(hr=hr1;hr<12;hr++)
					 {
						for(min=min1;min<60;min++)
						{
						 for(sec=0;sec<60;sec++)
						 {
							 if(start1==0)
								 goto here;
							lcd_cmd(0x81);
							delay(1);
							lcd_data_int(hr);
							lcd_data(':');
							lcd_data_int(min);
							lcd_data(':');
							lcd_data_int(sec);
							if(dig_am_pm==0)
							{
							 lcd("am");
							}
							else
							{
							 lcd("pm");
							}
							alarm_check();
							lcd_cmd(0xc3); 
							delay(2);
							lcd_data_string("TEMP:");
							temp();
							}
						}
					 min1=0;
					 }
					if(dig_am_pm==0)
					dig_am_pm=1;
					else
					dig_am_pm=0;
					hr1=0;
					}
				}
				here:
				{
					while(1)
					lcd_cmd(0x01);
				}
				}

help me out anyone!
 

Please Zip and post your complete Keil uVision project files. I will fix it. Also Zip and post Proteus file.
 
Please Zip and post your complete Keil uVision project files. I will fix it. Also Zip and post Proteus file.

ok...i switched back to adc0804 since i didnt require 8 input channels provided in adc0808.
sry for the previous posts.

now when i simulate the circuit, the temp part of the code doesn't seem to work due to which the clock doesn't start.
Though i receive no errors while compiling the code.

i have attached here all the possible files including proteus and zip file for code,also the snaps of some errors encountered during simulation.

plz help me out!
 

Attachments

  • proteus clock 2.zip
    262.4 KB · Views: 70

You didn't include the adc.h file in the code.
 

You didn't include the adc.h file in the code.

There is no adc.h!!
U might have seen the code....in that the main function calls the function "temperature()" which in turn calls the function "adc()"...and the "void adc()" does the adc conversion. There is no header file for it!

????
 

here's the code once again for convenience:
Code:
// Program to make a digital clock with integrated Alarm and digital thermometer
#include<reg51.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>

#define port P1
#define cont_port P3
#define dataport P2

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= cont_port^2;
sbit rd= cont_port^3;
sbit eoc= cont_port^4;
void adc();

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[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 shape()  // Function to create the shape of degree
{
lcd_cmd(64);
lcd_data(2);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
}

void set_hr1()  // Function to set set hours digit of clock
{
hr1++;
if(hr1>11)
hr1=0;
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
}

void set_min1()  // Function to set set minutes digit of clock
{
min1++;
if(min1>59)
min1=0;
lcd_cmd(0xc6);
lcd_data_int(min1);
}

void set_alarm_hr1() // Function to set set hours digit of alarm
{
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 set minutes digit of clock
{
alarm_min++;
if(alarm_min>59)
alarm_min=0;
lcd_cmd(0xc6);
lcd_data_int(alarm_min);
}

void alarm_check()  // Function to check alarm
{
if(hr==alarm_hr)
{
  if(min==alarm_min)
  {
   if(dig_am_pm==alarm_am_pm)
   {
    alarm=1;
    lcd_cmd(0x8b);
    lcd("ALARM");
   }
  }
} 
}

void temperature() // Function to calculate temperature
{
P0=0xFF;
eoc=0;
adc();
shape();
lcd_data('C');
}

void adc()
{
int value;
float temp;
 wr=0;
delay(1);
wr=1;
while(eoc==0);
rd=1;
delay(1);
rd=0;
value=P1;
temp=value*1.02;
temp=(int)(floor(temp));
lcd_data_int(temp);
delay(1);
}
 

void main()
{
int k;
start=1;
dig_hr1=1;
dig_min1=1;
alarm_set=1;
alarm=0;

lcd_cmd(0x83);
lcd("SET ALARM");
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(alarm_set==0)
{
  delay(10);
  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");
  }
	else
	{
  lcd_cmd(0xc8);
  lcd_data_string("pm");
  }	
}
delay(200);
lcd_cmd(0x01);
lcd_cmd(0x83);
lcd("SET TIMING");
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(start==0)
{
  delay(10);
  if(dig_hr1==0)
  set_hr1();
  if(dig_min1==0)
  set_min1(); 
	if(am_pm==0)
	{
  lcd_cmd(0xc8);
  lcd_data_string("am");
  }
	else
	{
  lcd_cmd(0xc8);
  lcd_data_string("pm");
  }
}
delay(200);
lcd_cmd(0x01);
while(1)
{
	for(k=0;k<2;k++)
  {
   for(hr=hr1;hr<12;hr++)
   {
    for(min=min1;min<60;min++)
    {
     for(sec=0;sec<60;sec++)
     {
			 if(start==0)
				 goto here;
			lcd_cmd(0x81);
      delay(1);
      lcd_data_int(hr);
      lcd_data(':');
      lcd_data_int(min);
      lcd_data(':');
      lcd_data_int(sec);
      if(dig_am_pm==0)
      {
       lcd("am");
      }
      else
      {
       lcd("pm");
      }
      alarm_check();
      lcd_cmd(0xc3); 
      delay(2);
      lcd_data_string("TEMP:");
      temperature();
      lcd_data_string("    ");
     }
    }
   min1=0;
   }
  if(dig_am_pm==0)
  dig_am_pm=1;
  else
  dig_am_pm=0;
  hr1=0;
  }
}
here:
{
	while(1)
	lcd_cmd(0x01);
}
}

and here's the proteus schematic:
Capture.JPG

the adc part doesn't seem to work, and because of that the clock doesn't function.
Otherwise the clock part is proper,no problem with that.!

guyz plz help me out!
 

If you need more help and want somebody to test your code and Simulation then Zip and attach the complete Keil project files and Proteus file.

I think ADC output pins are reversed in Proteus. Like DB0 is DB7 and DB7 is DB0 and similarly for other data out pins. Reverse the connections and see if it works.
 

If you need more help and want somebody to test your code and Simulation then Zip and attach the complete Keil project files and Proteus file.

I already did attach the zip file in my previous posts as you said. plz have a look at it.
 

I have written a new code but it doesn't compile. There are some syntax errors. Fix them and add buttons code and use it. New Proteus file attached. The ADC, RTC and LCD codes are correct. Just there are some syntax errors.
 

Attachments

  • DS1307 + LM35 rev1.rar
    72.6 KB · Views: 65

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top