Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/05/09 06:53
Read: times


 
#163083 - sorry I could not reply due to my ill health
Responding to: ???'s previous message
hi, Please tell me whether I am correct or not.

I have checked rtcce with an oscilloscope. what I found is some what interesting.
this is my program,
//interfacing ds12c887 real time clock using p89c61x2bn
/*pin out connections of the rtc with the micro controller.
micro controller <--> rtc
P89V51RD2 <--->  DS12C887
-------------------------
P0<---->ad0-ad7
;LCD dbo-db7 connected to P0.
ALE(pin 30)---->AS
!RD(pin16)----->Data strobe
;LCD RS is connected to the !RD pins
!WR(pin17)----->R/W
;LCD RW is connected to the !WR pins
--------------------------
other rtc connections;
MOT,CS,--->GND; intel bus timimg is selected.
RST-->Vcc; rest all i have left as no connection(SQW and IRQ).

note: the other micro controller pins such as 
!PSEN , RST, XLAT0, XLAT1 and the max232 connections 
are made accordingly. and i am pretty sure about them*/
/* desire output:
no access to RTC. no updating of time in hyper terminal window. 
the output i am getting:
accessing RTC, and also updated time in hyperterminal window.*/
//program
#include<reg51.h>
#include<absacc.h>
//whether i used xbyte or xdata, there is no change in //my output
volatile char xdata OSC _at_ 0x800a;//register a
volatile char xdata UPDATE _at_ 0x800b;//register b
volatile char xdata SEC _at_ 0x8000;
volatile char xdata HR _at_ 0x8004;
volatile char xdata MIN _at_ 0x8002;
volatile char xdata DD _at_ 0x8007;
volatile char xdata MM _at_ 0x8008;
volatile char xdata YY _at_ 0x8009;
sbit rtcce=P2^5;
sbit leden=P2^0;
#define output P0
void bcdconvert(unsigned x);
void serialsend(unsigned x);
void Delay(unsigned int);
unsigned char second,hour,minute;
void main(void)
{
	
	rtcce=1;//disable RTC...

	output=0x0fF;
	leden=1;
	leden=0;//disable all leds connected to P0 via //latch. leden is lactch enable.
	Delay(200);//i have given delay of 1 sec appx.
	OSC=0X20;//to turn on oscillator
	
	Delay(200);
	Delay(200);
	TMOD=0x20;//serial communication settings
	TH1=0xfd;
	SCON=0x50;
	TR1=1;
	Delay(200);
	
	OSC=0X2f;//to turn on the square wave
	UPDATE=0X8b;//to stop update

	SEC=0X01;	//set time
	MIN=0X45;	
	HR=0X04;
   	DD=0X28;	//21-02-08
	MM=0X02;
	YY=0X09;

	UPDATE=0X0b;//start update

	while(1){
	while( OSC & 0x80 );//to monitor uip
		second=SEC;
		hour=HR;
		minute=MIN;
		bcdconvert(hour);
		serialsend(':');
		bcdconvert(minute);
		serialsend(':');
		bcdconvert(second);
		serialsend(0x0d);
      serialsend(0x0a);				  
	}
}
//to convert to ascii
void bcdconvert(unsigned mybyte){
	unsigned  char x,y;
	x=mybyte&0x0f;
	x=x|0x30;
	y=mybyte&0xf0;
	y=y>>4;
	y=y|0x30;
	serialsend(y);
	serialsend(x);
	}
void serialsend(unsigned x){
	SBUF=x;	
	while(TI==0);
	TI=0;
	}
void Delay(unsigned int itime){
	unsigned int i,j,k;
	for(i=0;i<=itime;i++)
		for(j=0;j<=0xff;j++)
			for(k=0;k<=0x08;k++);
	}
//end of program

 

as you can see the rtc !cs has been high through out the program. but when i observed on an oscilloscope i found that for each cycle it is getting low for a very small interval and then again getting high.

if what Mr. Erik Malaund said is true, (that the Xdata keeps the higher byte '0' on P2 thus enabling my rtcce, why aren't my leds aren't being on? whose latch enable is on P2.0. more over after getting low, how come it become high immediately without giving it in the program?
Please explain me.

one last thing,
if I write the program without using the Xbyte type access(treating RTC as an external memory), how can i latch the address with out controlling AS pin of rtc(which is connected to ALE!)?
Please tell if there are any links or books where I can do some reference work regarding this method.

thanks in advance

List of 20 messages in thread
TopicAuthorDate
RTC DS12c887 Chip select            01/01/70 00:00      
   WHY ON EARTH            01/01/70 00:00      
      with the help of Xbyte or XDATA            01/01/70 00:00      
         Speaking the Truth.......            01/01/70 00:00      
            I don't see            01/01/70 00:00      
               what you said is true. but there is another            01/01/70 00:00      
         Even with !CS == 1 ??            01/01/70 00:00      
            I have done that before posting this thread!            01/01/70 00:00      
               How fast multimeter            01/01/70 00:00      
                  actually..            01/01/70 00:00      
   I just saw it            01/01/70 00:00      
      then I am in real trouble            01/01/70 00:00      
         replace the XBYTE with ...            01/01/70 00:00      
            sorry but...            01/01/70 00:00      
               or            01/01/70 00:00      
         Play with the ports            01/01/70 00:00      
            thank god            01/01/70 00:00      
   sorry I could not reply due to my ill health            01/01/70 00:00      
      it is            01/01/70 00:00      
         and Erik one last..            01/01/70 00:00      

Back to Subject List