Hi,
there's one pin depending on his level (high or low), the programm should / or should not transmit all the rs232 debug messages (printf()) to the hyperterminal.
How is it possible to use some #ifdefs | or is it much better to use a global variable?
#ifdef DEBUG_MODE //debug mode - transmit all msg to the hyperterminal #else //no debug messages #endif int main(void) { if(AT91C_BASE_PIOA->PIO_PDSR & 0x10) { /* -> transmit rs232 debug messages */ } else { /* do not transmit any debug messages */ } printf("only tansmit the msg if DEBUG_INIT is true"); while(1); }
best regards Tim
The canonical method is
#ifdef ENABLE_DEBUG_PRINTOUTS # define DEBUG_PRINTF(args) printf args #else # define DEBUG_PRINTF(args) /*nothing*/ #endif /*...*/ DEBUG_PRINTF(("outch, that %s hurt!\n", symptom));
Note: the double parentheses are important.
Thank you for your time & information.