AnsweredAssumed Answered

Pass Port/Pin Address to Function

Question asked by Abdallah El-Falou on Jun 8, 2012
Latest reply on Jun 12, 2012 by Abdallah El-Falou



I am interested in writing a function that takes the address of a port as its argument, so that I can write to that port from within my function. E.g


// Definition

void foo(unsigned char *pin) {

   *pin = 1;

   // ...



// Call




However, the compiler gives me the following error at the function call:

Error: C1833: Cannot take address of this object


I am running this code on an MC9S12XS128MAL. Can someone point me in the right direction?