Discussion in "Project Addition or Changes" started by    sagarspm    Sep 14, 2009.
Mon Sep 14 2009, 02:18 pm
#1
Hello Ajay,

I have downloaded your Digital clock C source code. I have modified the code also but it is not working. I am using 7 segmemt instead of LCD, also SDA & SCL pin in my case are different i.e. P2.0 & P2.1. Still it is not working. I am right now displaying only secs but it is not displaying. Can you pls check the code & suggest what is wrong, it will be great help to me. It displays only 03 & 29 alternately.

Sagar
Tue Sep 15 2009, 01:13 am
#2
you forget to attach your Code.
Tue Sep 15 2009, 09:12 am
#3
Hello Ajay,

Thanks for reply. Pls find attached code.
Attachment
Thu Sep 17 2009, 10:13 pm
#4
Hello Ajay,

Can you please give me tip by veiwing my code?

Sagar
Fri Sep 18 2009, 01:31 pm
#5
hey hav u connected pull up resistors to ur port pins if not use 10k pull up resistos
 sagarspm like this.
Fri Sep 18 2009, 04:39 pm
#6
Hi hplaneti,

Thanks for reply. I have connected the pull up but i have to check what value i have connected. If it is not of 10K value does it affect the working of RTC?...also.. have u gone through my code? I have doubt that i have not used any function to convert value comming from RTC. (Like BCD to hex or sometning). Does it require?
Sat Sep 19 2009, 04:32 pm
#7
BCD values doesnt need any conversion during display, just get the upper and lower nibble and display.

Can you give me a brief idea on how you are displaying on 7-segment??

also post your circuit.
Mon Sep 21 2009, 11:25 am
#8
Hello Ajay,

All the code is same as supplied by your web site. The only change I made is instead of LCD I used 7 seg. LED. I am not using your "disp_rtc" function, instead I am using "display" function from while(1).
From display function I am accessing your variable "rtc_recv_val[0]" for seconds(as i am only displaying seconds to start with). This variable "rtc_recv_val[0]" I am passing to function "hex_bcd" to display the value of seconds on 7 seg LED. The both the functions "display" & "hex_bcd" are as follows. The schematic i have not drawn as the only change in the schematic is LCD vs 7 seg. LED. But still i will drawn & will post ckt as early as possible.

void display(void)
{
hex_bcd(sec);
for(m=0;m<50;m++){
for(d=0;d<800;d++);
P3 = 0;
P1= buf[k]; //to display first digit of seconds
P3 |= 0x04;
for(d=0;d<800;d++);

for(d=0;d<800;d++);
P3=0;
P1= buf[l]; //to display second digit of seconds
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;
}

Thanks

Sagar

Wed Sep 23 2009, 02:02 am
#9
so hex_bcd updates your k,l and m variables which are then used in display function for displaying right?

if yes then what are u doin this in display()?

for(m=0;m<50;m++){


without even displaying, you're usiing that variable.
Sat Sep 26 2009, 02:58 pm
#10
Hello Ajay,

Thanks. I have cleared that m variable. Still it has problem. Its only displaying 28 now. Please help in sort it out. How to debug this problem? Now the code after I cleared "m" variable is as follows:

void display(void)
{
hex_bcd(rtc_recv_val[0]);
for(x=0;x<50;x++){
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;
}

Sagar

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