debug statements for pic18F

Status
Not open for further replies.

Anniyan_x

Member
Code:
1) #define DEBUG_PRINTS(x)  {(rom const char)table[][20] = x; putrsUSART("x");}
                                            
2) #define DEBUG_PRINTS(x)  putrsUSART( (const far rom char *)"\n\rx.\n\r" );

3) #define DEBUG_PRINTS(x)   (rom const char *rom table2[] = {"x"};  putrsUSART("x");)

hi refering to the above codes, i planning to have a debug print on UART, by just making the debug print statement as a macro can can be used in any functions in any c files to print out any debug statements by just defining it as DEBUG_PRINTS(uart is ok); or DEBUG_PRINTS(TIMER IS RUNNING); . anyway i tried above 3 routine which didnt compile and have syntax error except for number 2 which prints only x although i put other character in it, i trully dont have any idea and just using trial and error way to find a working code..hope somebody can suggest on this.
 
Last edited:
finall this works:-

#define DEBUG_PRINTS(a) {static const rom char table[]= a; putrsUSART(&table[0]);}

in main u call as:-

DEBUG_PRINTS("test0");
DEBUG_PRINTS("test1");
DEBUG_PRINTS("test2");
DEBUG_PRINTS("test3");
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…