Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/24/07 19:47
Read: times


 
#141196 - Unexpected change in a variable
Hi a variable is changing unexpectedly, for instance the original. char = 1 the new value = 10. Interesting, the place it changes in the C code, is a location not being called.

If I change the memory location from xdata to data there is no different. If I repeat the above but move the data close to the effected Var, the problem disappears. (I would like to determine the root cause, so the above is not a solution).

Using the dis_assembly and mapping it to the "C" source, I can ID where it’s occurring. Below is the source code. and the calling function:


Pamp_V0[PUMP_B] = uart_getint16();
->Change in var, occurs here in the disassembly

unsigned int uart_getint16(void)
{
unsigned char xdata ch1;
unsigned char xdata ch2;
unsigned int xdata value;

ch1 = uart_getch();
ch2 = uart_getch();

value = (unsigned int)ch1*(unsigned int)256 + (unsigned int);

return(value);
}

Any Ideas Why/Solutions?
Spencer








List of 5 messages in thread
TopicAuthorDate
Unexpected change in a variable            01/01/70 00:00      
   Need more info            01/01/70 00:00      
      solution maybe?            01/01/70 00:00      
         buffer overrun?            01/01/70 00:00      
   More debugger fights?            01/01/70 00:00      

Back to Subject List