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.

RTC 12C887 Issue with P89V51RD2

Status
Not open for further replies.

scintrillating

Newbie level 3
Joined
Jan 2, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,320
I have Interfaced 12C887 with P89V51RD2 but the time update does not occur. However the same code when burned in AT89C51, works perfectly...But due to memory restrictions of 4Kb in the Later, we have to use the former. Please help me out on this issue, ASAP!

The Code is :

Code:
#include <P89V51Rx2.H>
#include<ABSACC.h>

#define port P3
#define lcd_dataport P2  // lcd_dataport for lcd
#define keypad P1  // Port for keypadpad
#define timeport P0 // Port for RTC

sbit rs = port^0;
sbit rw = port^1;
sbit en = port^5;

int hr, min, sec;

void delay(unsigned int msec) //Time delay function
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}

void lcdcmd(unsigned char item) //Function to send command to LCD
{
lcd_dataport = item;
rs=0;
rw=0;
en=1;
delay(1);
en=0;
return;
}

void lcddata(unsigned char item) //Funtion to send data on LCD
{
lcd_dataport = item;
rs=1;
rw=0;
en=1;
delay(1);
en=0;
}

void lcddata_string(unsigned char *str) // Function to send string on LCD
{
int i=0;
while(str[i]!='\0')
{
lcddata(str[i]);
i++;
delay(1);
}
}

void lcd(unsigned char str[10])  // Funtion display string on LCD
{
lcdcmd(0x38);
lcdcmd(0x0C);
lcdcmd(0x01);
lcdcmd(0x80);
lcddata_string(str);
}

void rtc_read(unsigned char item)
{
timeport = item;
}

void rtc_write(unsigned char item)
{
timeport = item;
}

void bcdconv(unsigned char mybyte)
{
unsigned char x,y;
x=mybyte&0x0F;
x=x|0x30;
y=mybyte&0xF0;
y=y>>4;
y=y|0x30;
lcddata(y);
lcddata(x);
}

void main()
{
delay(220);
XBYTE[11]=0x82;
XBYTE[4]=0x15;
XBYTE[2]=0x55;
XBYTE[0]=0x00;
XBYTE[11]=0x02;
lcd("TIME:");
while(1)
{
lcdcmd(0x88);
rtc_read(0x00);
}
}
 
Last edited by a moderator:

You can go for At89S52 which is cheaper than AT89c51 and works fine and similar like AT89C51
 

here is the schematic...please check it out

12c887.JPG
 

for one thing you need a proper reset (RC) circuit on the reset line of the MCU.

a 10uF cap from reset to VCC, and an 8.2K resistor from reset to GND.

While your circuit may work for some 8051's, it won't for others so you need to install the resistor and capacitor.

Let us know if it helped.
 

the issue is solved, i just need to change those XBYTE locations as P89V51RD2 already had 768 bytes of RAM in it. So to access the external I just had to skip those in the MCU!
 

I couldn't understand how u resolved the problem, can u please elaborate that....??
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top