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 my variable become to zero??

hi all

This is a piece of my coce,it complier by large model

In main.c

uchar volatile xdata *data ptr_reg;
unsigned char pdata g_size;

void dma_task_execute (void) small
{
  size =  g_size;
  do_something();
}

void main(void)
{
 while (1)
{
EA = 0;
dma_task_execute();
EA = 1;
}

}

In Int.c


extern unsigned char volatile xdata *data ptr_reg;
extern unsigned char pdata g_size; void int_handler(void) interrupt 2
{ EA = 0; g_size = ptr_reg[X_addr]; EA = 1; }


I found the data store into g_size in int_handler function is correct,but why g_size will become to zero when run dma_task_execute() sometimes ?? The vlaue of g_size is never will be zero,but why it will become to zero in dma_task_execute() sometimes?? Sorry my poor english any comment is welcome Best regards

Parents Reply Children
No data