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.

ds12887 rtc interfaced with p89v51rd2 problem

Status
Not open for further replies.

digitalkim

Newbie level 6
Joined
Oct 27, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
punjab
Activity points
1,357
hi
m using p89v51rd2 controller and i've interfaced ds12887 with it..
i've written a code to set time via a matrix keyboard....
when i set the time the changed time is accepted but its not being updated....i displayed the time on jhd162a lcd.

The increment in seconds is not been shown thr,,,

if i set the time to 14:12:00 it will be fixed...

but when i write the same code to at89s52 controller its working perfectly...
can anybody please help.....
i changed the headerfile too....for phillips controller-->p89v51rd2.h
for s52-->at89s8252.h
please do reply as soon as possible,...
thanks in advance....
 

ctownsend

Advanced Member level 2
Joined
Nov 27, 2004
Messages
575
Helped
93
Reputation
188
Reaction score
63
Trophy points
1,308
Location
Canada
Activity points
3,667
Is the battery good in your ds12887? How old is it?

If you don't post your code and a schematic you probably won't get much help here.
 

vigneshwara_s

Member level 1
Joined
Oct 5, 2006
Messages
39
Helped
7
Reputation
14
Reaction score
0
Trophy points
1,286
Location
Chennai
Activity points
1,543
Hi ..

You are saying that the same configuration of hardware when working with AT89S52
its i working well and its not with P89V51RD2.

Good ..

The issue may be with the code . Let us see your code and the pin assignments you have made for the interface and Tell you where the problem may be ..

Then .. Did you use the same PCB for the AT89S52 and P89V51RD2 Controller.

Regards

Vikeee ..
+919884342875
 

digitalkim

Newbie level 6
Joined
Oct 27, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
punjab
Activity points
1,357
yes i used the same pcb but removed resistor connected to the 29 pin of the controller from ground to be used for p89v51rd2 as recommended by my training teacher...
rest all the other code is working on it except updation of rtc time...
i'll post the code of rtc tomo morning its not available with me right now....

the battery is not so old its a new kit.but still i'll check that out....

n thanks for the replies.....
 

vigneshwara_s

Member level 1
Joined
Oct 5, 2006
Messages
39
Helped
7
Reputation
14
Reaction score
0
Trophy points
1,286
Location
Chennai
Activity points
1,543
If that is the case , Is your Board Reading the time from the RTC well ?.

If it is reading and displaying the timings and not accepting the new time , the problem may be related with the Firmware most probably..

let us see after you paste the RTC read code and Time Update code.
Regards,
S.vigneshwaran
 

digitalkim

Newbie level 6
Joined
Oct 27, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
punjab
Activity points
1,357
hi
here i provided the code and hardware connection of rtc n the controller
please suggest any changes u think should be done..
this code involves just reading rtc and displaying the time on lcd...
entry through keypad n all the other stuff is in other code...

updating of time is not done through this code also...

i even tested this code with value of rega=0x20; but same problem....
don't consider the lcd connctions here in this schematic given....its not perfect one according to ma kit.

Code:
#include<p89v51rd2.h>

#define LCD P1
#define RS P3_3
#define EN P3_4

code unsigned char sun[]=  {"SUN  #"};
code unsigned char mon[]=  {"MON  #"};
code unsigned char tues[]= {"TUES #"};
code unsigned char wed[]=  {"WED  #"};
code unsigned char thurs[]={"THURS#"};
code unsigned char fri[]=  {"FRI  #"};
code unsigned char sat[]=  {"SAT  #"};

void delay(unsigned int d);
void lcd_cmd(unsigned char c);
void lcd_init(void);
void cursor_position(unsigned char cp);
void display(unsigned char d);
void bcdconv(unsigned int mb);
void string_display(unsigned char *s);
void pday(unsigned char d);

struct rtc
{
 unsigned char second;
 unsigned char sa;
 unsigned char minute;
 unsigned char ma;
 unsigned char hours;
 unsigned char ha;
 unsigned char dow;
 unsigned char dom;
 unsigned char month;
 unsigned char years;
 unsigned char ra;
 unsigned char rb;
 unsigned char rc;
 unsigned char rd;
 };
 xdata at 0x0000 struct rtc ds12887;
void main()
{

unsigned char sec;
unsigned char hr;
unsigned char min;
unsigned char md;
unsigned char mon;
unsigned char year;
unsigned char day;

ds12887.ra=0xa0;
ds12887.rb=0x82;
ds12887.second=0x00;
ds12887.minute=0x21;
ds12887.hours=0x14;
ds12887.dom=0x20;
ds12887.month=0x11;
ds12887.dow=0x04;
ds12887.years=0x09;
ds12887.rb=0x02;

lcd_init();

while(1)
{
hr=ds12887.hours;
cursor_position(0x00);
bcdconv(hr);

display(':');
min=ds12887.minute;
bcdconv(min);

display(':');
sec=ds12887.second;
bcdconv(sec);

md=ds12887.dom;
cursor_position(0x40);
bcdconv(md);

display('/');
mon=ds12887.month;
bcdconv(mon);

display('/');
year=ds12887.years;
bcdconv(year);


day=ds12887.dow;
cursor_position(0x49);
pday(day);
//delay(300);
}
}
void delay(unsigned int d)
{
while(d!=0)
{
d--;
}
}
void lcd_init(void)
{
lcd_cmd(0x01);
lcd_cmd(0x38);
lcd_cmd(0x0c);
}
void lcd_cmd(unsigned char c)
{
delay(300);
LCD=c;
RS=0;
EN=1;
EN=0;
}
void display(unsigned char d)
{
delay(300);
LCD=d;
RS=1;
EN=1;
EN=0;
}
void string_display(unsigned char *s)
{
	while(*s!='#')
	{
		display(*s);
		s++;
	}
}
void cursor_position(unsigned char cp)
{
lcd_cmd(0x80+cp);
}
void pday(unsigned char d)
{
unsigned char b;
b=0;b=d;
switch(b)
{
	case 1:
	{
		string_display(sun);
		break;
	}
	case 2:
	{
		string_display(mon);
		break;
	}
	case 3:
	{
		string_display(tues);
		break;
	}
	case 4:
	{
		string_display(wed);
		break;
	}
	case 5:
	{
		string_display(thurs);
		break;
	}
	case 6:
	{
		string_display(fri);
		break;
	}
	case 7:
	{
		string_display(sat);
		break;
	}
}
}
void bcdconv(unsigned int mb)
{
unsigned char x;
unsigned char y;
x=mb&0x0f;
x=x|0x30;
y=mb&0xf0;
y=y>>4;
y=y|0x30;
display(y);
display(x);
}

waiting for ur suggestions..
tanks in advance...
 

digitalkim

Newbie level 6
Joined
Oct 27, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
punjab
Activity points
1,357
@ctownsend
hi
my rtc is getting 4.9v supply.....
can u suggest anything else regarding this problem.....
the circuit and the code is given in the attachment above...
thanks
waiting for the suggestions...
thanks in advance....
 

tejinder devgon

Newbie level 1
Joined
Oct 13, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
5
mov 8Eh,#03h


put this command at starting of code ; for 768 byte xram

then 12c887 run on p89v51rd2fn also

Tejinder devgon
IISER Mohali
Techincal officer
www.strobotix.com
Embedded System
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top