Discussion in "Project Addition or Changes" started by    sagarspm    Sep 14, 2009.
Sat Sep 26 2009, 03:03 pm
#11
Sorry the corrected code is as follows:

void display(void)
{	  
		hex_bcd(rtc_recv_val[0]);
		for(y=0;y<50;y++){
		for(d=0;d<800;d++);
		P3 = 0;
		P1 = buf[k];		
		P3 |= 0x04; 
		for(d=0;d<800;d++);
					
		for(d=0;d<800;d++);
		P3=0;		
		P1= buf[l];		
		P3 |= 0x20;
		for(d=0;d<800;d++);	
		}

}

void hex_bcd(bit_8 x)
{	
	k = x%10;  //500%10= 0 
	x = x/10; //500/10 = 50
	l = x%10; //50%10 = 0
	x = x/10; //50/10 = 5
	m = x;
	n = 0;
}


[ Edited Sat Sep 26 2009, 06:44 pm ]
Sat Sep 26 2009, 06:46 pm
#12
its better to test with displaying a static value or a simple counter from 1 to 10 or something.. coz its not even sure RTC is being read properly or not.. getting me?

so write a program to count from 1 to 10 and display on 7-seg so you can be sure your display part is working fine ok?
Mon Sep 28 2009, 11:52 am
#13
Hello Ajay,
I have already tested the display & it is working fine. I displayed from 00 to 60 on display. I am doubtful whether RTC is being read properly or not.
But i have used the same code of yours upto the reading of RTC. The values which are being read by your code in variable "rtc_recv_val[y]" the same i am using to display on 7 seg LED. Second doubt i feel is do i need to process the value in variable "rtc_recv_val[y]" before displaying on 7 seg LED.
What i read & bit confuse from the data sheet of DS1307 is the values received from RTC are in BCD format. Do we need to convert values (received from RTC) in any other format? Coz.. i saw the functions "hex_dec()" & "dec_hex()" in your code which i am not using. Does that make any difference? Please focus on this.

Sagar
Tue Sep 29 2009, 04:42 pm
#14
those functions were for some other purpose, used in set time function.

well all you need is to get those two values.. i think your conversion is not correct thats why you are getting wrong display.

try this one..
void hex_bcd(bit_8 x)
{      
        k = (x>
>
4)&0x0F;
        l = (x&0x0F);
}
 sagarspm like this.
Wed Sep 30 2009, 09:57 pm
#15
Hey Ajay,

Thanks a Lot!!! RTC started working. Really thanks.Now i am moving ahead with keyboard interface. If i come across any problem i will come back to you. Once the project is complete i will donate this project on ur web site. Once again thanks.

Sagar
Fri Oct 02 2009, 12:32 pm
#16
Hello Ajay,

I come across one diffuclt while displaying hours. The hours are displaying as 52 on LED & it is reducing by 1 after every 60 minutes. Right now i am displaying hours & minutes on LED. Also i have initialize hours as 0x52 from the variable
"rtc_ini_val[2]=0x52;" using function RTC_INI().
Please comment.

Sagar

The changed website view looks very good now.


Sat Oct 03 2009, 11:12 am
#17
well hrs has a format.. if you have checked it.
i recommend you to use 24 hr format as you are having a LED display.

if you check page 8 of datasheet of DS1307 you will see a table at bottom "Timekeeper registers"
in that 02H is for hour.
so you can see the breakup.
Bit 7 is always 0
Bit 6 is to select 12/24 hr format
Bit 5 has two different functions: in 12 hr format it shows AM/PM in 24 hr format it shows 10s digit of hour.
Bit4-Bit0 are hours in both 12 and 24 hr format.

Now in initialization i made hr register as 52H if you breakup.. you will get 01010010 (binary). so you can see bit 6 is 1 so its 12 hr format.

you can initialize your clock with bit 6 zero and rest bits whatever time you want to set. while reading you can directly read the clock and display coz it will always give you right time in 24 hr format.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am