im working on a project that uses an lcd module. i wrote the code in a separate file from main() so that i could easily use it for other projects. the problem is that i want to be able to define what ports and pins it uses for various signals without having to change the actual code each time i change pin configs. i tried using #define in the main() file but got errors (found out later that macros only have file wide scope) after i figured that out i tried moving my macros to the lcd file. the code looks something like
#define LCD_DATA PORTB//define lcd control and data lines
the original errors went away but now i get multiple errors saying
'PORTB' undeclared (first use in function)
im guessing that the preprocessor only replaces LCD_DATA with PORTB and then doesnt take it any further. does anyone know of a right way to do what im trying to do?