This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why can't I use xdata variable in NXP P89C669?

My code is just as simple as below:

static unsigned int xdata user_timer_count[8];
static unsigned int xdata count[8];

void func1()
{

}

void main()
{
    int j;
    user_timer_count[2] = 1000;
    count[2] = user_timer_count[2];

    while(1)
    {
        for(j=0;j<8;j++)
        {
            if(count[j]==0) continue;
            if(count[j]==1)
            {
                count[j] = user_timer_count[j];
                func1();
                continue;
            }
            --count[j];
        }
    }
}


The question is when I declare count as xdata, my program crashes in a uncertain time later.
Even after I press reset button, It doesn't work properly. I have to turn down the power and restart.

when I declare:

static unsigned int count[8];


It seem to worked well. I don't know whether it will crash some longer time later, or it's all right.
I'm using Small Momery Model, on-chip ROM and XROM. Who can give me some suggestion?

0