AnsweredAssumed Answered

9S12XEP100: how to access variable in RPAGE?

Question asked by TIM NGUYEN on Feb 3, 2016
Latest reply on Feb 4, 2016 by Edward Karpicz

I need to assign many variables in the multiple RPAGEs (due to total number of vars exceed the one RPAGE size)

To access a var in RPAGE, the Freescale technical document TN238 shows as follows:


unsigned char rub_far_var;


A pointer pointing to such a variable can be defined as follows:

unsigned char * __rptr ptr_on_far_var;

Then assign the pointer to this var

ptr_on_far_var = &rub_far_var;

if you want to access this var, you need to use this pointer.

ptr_on_far_var = 5;

if (ptr_on_far_var == 5)




My question is that can I just assign __far var instead?

all I need to do is as follows:


unsigned char __far rub_far_var;


rub_far_var = 5;

if (ptr_on_far_var == 5)




the compiler should know where to allocate the var in the RPAGE, retrieve the var from the correct RPAGE

and function the same as __rptr. So I don't need to assign an extra pointer for every variable in the code.


It seems to work. I would like a confirmation.