myhumps007
Newbie level 6
View attachment cl.bmpView attachment cl.bmp
hi...im making a digital clock using DS12887 and at89c52.
I just wrote time reading and displaying code...
i wanted to display on 7-segment(comon cathode) using BCD decoders(4511).
i test my circuit for seconds..they are working fine but for minutes and hours,it is malfunctioning on displays...(schematic attached).
plz help...!!!!1
HERE IS the CODE:
#include <reg51.h>
#include<absacc.h>
void init(void);
void MSDelay(unsigned int);
unsigned char hr,min,sec;
void main(void)
{
MSDelay(200);
XBYTE[10]=0x20;
XBYTE[11]=0x83; //bcd,24hrs,dse
XBYTE[0]=0x55;//55sec
XBYTE[2]=0x58; //58min
XBYTE[4]=0x16; //16hr :19.58.55
XBYTE[7]=0x19; //27
XBYTE[8]=0x10; //12
XBYTE[9]=0x04; //10/04/2003
XBYTE[11]=0x03;
TMOD=0x20;
TH1=0xFD; //9600 baud rate
SCON=0x50;
TR1=1;
while(1)
{
hr = XBYTE[4]; //get hour---this is not showing fine on P1,same for minutes
P1=hr;
min = XBYTE[2]; //get min
//P1=min;
sec=XBYTE[0];//get sec---ok for seconds
//P1=sec;
}
}
void MSDelay(unsigned int itime){
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}
hi...im making a digital clock using DS12887 and at89c52.
I just wrote time reading and displaying code...
i wanted to display on 7-segment(comon cathode) using BCD decoders(4511).
i test my circuit for seconds..they are working fine but for minutes and hours,it is malfunctioning on displays...(schematic attached).
plz help...!!!!1
HERE IS the CODE:
#include <reg51.h>
#include<absacc.h>
void init(void);
void MSDelay(unsigned int);
unsigned char hr,min,sec;
void main(void)
{
MSDelay(200);
XBYTE[10]=0x20;
XBYTE[11]=0x83; //bcd,24hrs,dse
XBYTE[0]=0x55;//55sec
XBYTE[2]=0x58; //58min
XBYTE[4]=0x16; //16hr :19.58.55
XBYTE[7]=0x19; //27
XBYTE[8]=0x10; //12
XBYTE[9]=0x04; //10/04/2003
XBYTE[11]=0x03;
TMOD=0x20;
TH1=0xFD; //9600 baud rate
SCON=0x50;
TR1=1;
while(1)
{
hr = XBYTE[4]; //get hour---this is not showing fine on P1,same for minutes
P1=hr;
min = XBYTE[2]; //get min
//P1=min;
sec=XBYTE[0];//get sec---ok for seconds
//P1=sec;
}
}
void MSDelay(unsigned int itime){
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}