| ??? 03/03/08 15:39 Read: times |
#151814 - sorry i can't reply due to my ill health Responding to: ???'s previous message |
dear mr. Andy Neil,
i have modified my program using _at_ macro but still i am getting the same output(un-updated). i have also noticed one more thing.i have removed the power supply to RTC and checked it again.still i am getting the output. this shows that the program in the micro controller isn't initialising the RTC registers. i have already replaced the IC. i am sending u the program.
#include<reg51.h>
#include<absacc.h>
volatile char xdata OSC _at_ 10;
volatile char xdata UPDATE _at_ 11;
volatile char xdata SEC _at_ 0;
volatile char xdata MIN _at_ 2;
volatile char xdata HR _at_ 4;
void bcdconvert(unsigned x);
void serialsend(unsigned x);
void Delay(unsigned char);
unsigned char h,m,s;
//4 HRS 10 MIN 55 SEC
//-------------main ---------------
void main(void){
//rtc requires 200ms delay to turn on
Delay(200);
//sending in bcd format
OSC=0x20;
//stop update
UPDATE=0x83;
SEC=0x55;
MIN=0x10;
HR=0X16;
//start update
UPDATE=0x03;
//serial communication settings
TMOD=0x20;
TH1=0xfd;
SCON=0x50;
TR1=1;
//---------------------------------------
while(1){
s=SEC;
m=MIN;
h=HR;
bcdconvert(h);
serialsend(':');
bcdconvert(m);
serialsend(':');
bcdconvert(s);
serialsend(0x0d); //carriage return
serialsend(0x0a); //newline
}
}
//-----------end of main----------------
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);
}
//send serially to pc
void serialsend(unsigned x){
SBUF=x;
while(TI==0);
TI=0;
}
void Delay(unsigned char x){
unsigned char i,j;
for(i=0;i<x;i++)
for(j=0;j<1000;j++);
}
|
| Topic | Author | Date |
| Real Time Clock and other | 01/01/70 00:00 | |
| How to post source code | 01/01/70 00:00 | |
| post- source code | 01/01/70 00:00 | |
| internal XRAM? | 01/01/70 00:00 | |
| its not logical but | 01/01/70 00:00 | |
| modified code using UIF | 01/01/70 00:00 | |
| re | 01/01/70 00:00 | |
| UIP | 01/01/70 00:00 | |
| Will get stuck | 01/01/70 00:00 | |
| If you used _at_ instead of XBYTE .... | 01/01/70 00:00 | |
| Comments | 01/01/70 00:00 | |
| reply to coments | 01/01/70 00:00 | |
| _at_ instead of XBYTE | 01/01/70 00:00 | |
| pin assignments | 01/01/70 00:00 | |
| You still haven't answered the questions! | 01/01/70 00:00 | |
| xdata i/o | 01/01/70 00:00 | |
| just do it | 01/01/70 00:00 | |
| Default | 01/01/70 00:00 | |
| sorry i can't reply due to my ill health | 01/01/70 00:00 | |
| address | 01/01/70 00:00 | |
| perfect!! | 01/01/70 00:00 | |
| try to understand | 01/01/70 00:00 | |
yes i finally got the point | 01/01/70 00:00 | |
| Aside: Not a macro | 01/01/70 00:00 | |
| Delay? | 01/01/70 00:00 | |
| agree | 01/01/70 00:00 | |
| Keil know | 01/01/70 00:00 |



