Help
Advanced Member level 2
Hi,
Anyone can help me the code below:
I am using AT89C52 microcontroller.
Why after i declare the array a as 'xdata' the Port 0 will not functioning. After remove the 'xdata' then the Port 0 will working fine. It functioning on Keil Simulation but on practically it doesn't work but it can functioning on Port 1. Why? Is it anything wrong on my code? Anything i can do? Anyone can help me and test it?
Thank You.
Anyone can help me the code below:
Code:
#include <reg52.h>
#define countNum P0
xdata unsigned char a[40];//'xdata'will couse the P0 problem.Why?? If P1 OK!
void Deley(unsigned int Dly)
{
int i, j , k;
for( i=0; i<255; i++)
{
for( j=0; j<Dly; j++)
{
for( k=0; k<1; k++);
}
}
}
void Run(void)
{
static unsigned char count;
if(count<16)
{
countNum = count;
a[count] = 1;
count++;
}
if(count>15)
{
count = 0;
}
}
void main()
{
while(1)
{
Run();
Deley(100);
}
return;
}
I am using AT89C52 microcontroller.
Why after i declare the array a as 'xdata' the Port 0 will not functioning. After remove the 'xdata' then the Port 0 will working fine. It functioning on Keil Simulation but on practically it doesn't work but it can functioning on Port 1. Why? Is it anything wrong on my code? Anything i can do? Anyone can help me and test it?
Thank You.