We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.