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

Hello,

 

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

foo(&PORTK_PK1);

 

 

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?

 

Thanks,

Outcomes