dinesh401
Advanced Member level 4

sir, i am trying to display time on a 7 segment display using ds12887 and at89s52 controller. I am using port 0 to interface ds 12887 and using four 7447 BCD to 7 seg decoder at port 1 and port 3. My hardware module was working correctly. When i am dumping my program with some initial values it was giving only the value. The time wasn't changing. Below is my program.
#include<reg51.h>
#include<absacc.h>
#define BYTE unsigned char
#define SECOND 0x22
#define MINUTES 0x41
#define HOURS 0x01
#define DAY 0X22
#define MONTH 0X05
#define YEAR 0X11
void main(void)
{
delay(200);
XBYTE[10]=0X20; //turn on osc.
XBYTE[11]=0X83; //BCD, 24hrs, daylight savings
XBYTE[0]=0X40; //SECOND=40H FOR BCD
XBYTE[2]=0X41; //MINUTE=40h for BCD
XBYTE[4]=0X01; //HOUR=01h for BCD
XBYTE[7]=0X22; //DAY=22H
XBYTE[8]=0X05; //month=05h
XBYTE[9]=0X11; //year=11h
XBYTE[11]=0X03; //allow update
}
This is my intialization program.
#include<reg51.h>
#include<absacc.h>
#define BYTE unsigned char
#define SECONDS 0x44
#define MINUTES 0x41
#define HOURS 0x01
char hr, min;
void delay(int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void main()
{
P1=0x00;
while(1)
{
hr=XBYTE[4];
P1=hr;
min=XBYTE[2];
P1=min;
}
}
This is my time program to display on 7 segmnt display.
Can you tel me the problem plzz
#include<reg51.h>
#include<absacc.h>
#define BYTE unsigned char
#define SECOND 0x22
#define MINUTES 0x41
#define HOURS 0x01
#define DAY 0X22
#define MONTH 0X05
#define YEAR 0X11
void main(void)
{
delay(200);
XBYTE[10]=0X20; //turn on osc.
XBYTE[11]=0X83; //BCD, 24hrs, daylight savings
XBYTE[0]=0X40; //SECOND=40H FOR BCD
XBYTE[2]=0X41; //MINUTE=40h for BCD
XBYTE[4]=0X01; //HOUR=01h for BCD
XBYTE[7]=0X22; //DAY=22H
XBYTE[8]=0X05; //month=05h
XBYTE[9]=0X11; //year=11h
XBYTE[11]=0X03; //allow update
}
This is my intialization program.
#include<reg51.h>
#include<absacc.h>
#define BYTE unsigned char
#define SECONDS 0x44
#define MINUTES 0x41
#define HOURS 0x01
char hr, min;
void delay(int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void main()
{
P1=0x00;
while(1)
{
hr=XBYTE[4];
P1=hr;
min=XBYTE[2];
P1=min;
}
}
This is my time program to display on 7 segmnt display.
Can you tel me the problem plzz