PDA

View Full Version : Conditional Compilation



milestag
- 3rd March 2006, 13:52
Is there any way to do "conditional compiling" within the BASIC source file? Or from the IDE? I'm thinking along the lines of how MPASM allows Conditional Assembly using DEFINES, IFDEF THEN, etc. to include or exclude certain lines of code.

I don't see anything in the PBP language, but is there some clever workaround that anyone uses? For example, if you need to compile the same source file for different PICs, you could just change a single define at the beginning of the file. Or in order to enable or disable certain functions within the code.

Jim

BigWumpus
- 3rd March 2006, 19:02
Just try this inside PBP:


DEFINE Switch1



@ ifdef Switch1
...
@ endif



and comment the DEFINE out if you dont want to compile the part.
This doesn't work for EEPROM-content.

milestag
- 3rd March 2006, 20:29
Awesome! And it's simple too!

I'll give it a try very soon. Many thanks.

Jim