Hi,
I have the following problem with #Define:
I have to define a pin depending on the configuration of the program.
Let me explain helping me with the sample program I have attached.
This pin changes depending on whether the program should work in a serial configuration or I2C.
So I create some #define that assemble me the required program sections.
In the attached program, the compiler always recognizes PORTB.0 instead of PORTB.2 that should be recognized with #define setup.
The compiler is the last version.
Ciao.
Hi. Define cannot be used within the #ifdef. Use script instead and this will work as expected. Remember, to a constant use use T_PR = Portb.0. Look at glcd.h for extensive use of script in the same context.
Last edit: Anobium 2016-08-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have the following problem with #Define:
I have to define a pin depending on the configuration of the program.
Let me explain helping me with the sample program I have attached.
This pin changes depending on whether the program should work in a serial configuration or I2C.
So I create some #define that assemble me the required program sections.
In the attached program, the compiler always recognizes PORTB.0 instead of PORTB.2 that should be recognized with #define setup.
The compiler is the last version.
Ciao.
Giacomo
Hi. Define cannot be used within the #ifdef. Use script instead and this will work as expected. Remember, to a constant use use T_PR = Portb.0. Look at glcd.h for extensive use of script in the same context.
Last edit: Anobium 2016-08-06
You are always polite and helpful.
Thank you.