AnsweredAssumed Answered

Comparing two variables in different ram pages

Question asked by lucianopalacios on Nov 29, 2012
Latest reply on Nov 29, 2012 by lucianopalacios

Hello,

 

for my project with MC9S12XF512, I'm trying to compare two variables which are in different ram pages. When I debug it I can see in Data window that the value of both variables are equal but the comparison results false.

 

Here a code example of this problem

 

#pragma DATA_SEG PAGED_RAM

uint8 variable1 = 0xff;

 

#pragma DATA_SEG DEFAULT

uint8 variable2 = 0xff;

 

void main(void)

{

  volatile uint8 aux = 0;

 

  while(1)

  {

    if( variable1 == variable2 )

    {

      aux = 1;

    }

    else

    {

      aux = 2;

    }

  }

}

 

 

The result is always "aux = 2". What would be the right way to compare these variables?

 

Many thanks in advance.

Best regards


Outcomes