HI silvio,
I have done the changes as you had stated, but i still am not able to get it working...Pls do help...My corrected code is below for your reference.
#include<AT89x051.h>
#define TON 79;
#define TOFF 79;
unsigned int ta,tb;
void delay(int count);
char a[10]={0x07,0x17,0x27,0x37,0x47,0x57,0x67,0x77,0x87,0x97};
char b[10]={0x0B,0x1B,0x2B,0x3B,0x4B,0x5B,0x6B,0x7B,0x8B,0x9B};
scanled();
void main(void)
{
int td,tc,m;
tc=TON;
td=TOFF
while(1){
P3_7=1;
for(m=0;m<tc;m++){
if(P3&0x40==0)
ta++;
}
delay(3);
P3_7=0;
for(m=0;m<td;m++){
if(P3&0x40==1)
tb++;
}
tb=tb+td;
delay(3);
scanled();
}
}
scanled(){
unsigned int i,flag=0,j;
static unsigned int k,h;
k=ta;
h=tb;
if(tb==0){
for(i=0;i<2;i++){
flag=1-flag;
if(flag==1){
P1=a[(k)/10];
for(j=0;j<32000;j++);
P1=0xFF;
}
if(flag==0){
P1=b[(k)%10];
for(j=0;j<32000;j++);
P1=0xFF;
}
}
}
else if(ta==0){
for(i=0;i<2;i++){
flag=1-flag;
if(flag==1){
P1=a[(h)/10];
for(j=0;j<32000;j++);
P1=0xFF;
}
if(flag==0){
P1=b[(h)%10];
for(j=0;j<32000;j++);
P1=0xFF;
}
}
}
}
void delay(int count)
{
int j,l;
for(j=0;j<= count;j++)
{
for (l=0;l<=120;l++);
}
}
Really do appreciate your help. Thank you.