This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

passing a port/pin to a function

hi,

i have a question regarding passing a port/pin to a function.

i have written a piece of code as below

#define LED_PIN P1_0 // bit LED_PIN = P1_0 also does not work

void blink(bit pin, int delayTime, int blinkCount)
{ while( --blinkCount ) { pin = !pin ; delay(delayTime) ; // function to generate delay...this works fine }
}

void main()
{ blink( LED_PIN, 1000, 10 ) ;
}

this also does not work if i code the blink function as a macro.

is there any way i can pass the address/pin name to the function? i am using keil compiler for 89C51 MCU.

0