Conditional Compilation


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72

    Default Conditional Compilation

    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
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    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.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Awesome! And it's simple too!

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

    Jim

Similar Threads

  1. conditional defines in PBP?
    By rdxbam in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th March 2010, 14:40
  2. Elapsed_Demo.bas compilation errors
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st March 2010, 23:44
  3. Warning (and other Compilation Error) Messages
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 6
    Last Post: - 9th September 2009, 01:29
  4. LONG var, conditional invert sign
    By dcorraliza in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th May 2008, 19:47
  5. Problem during compilation 16F676
    By mat janssen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th October 2005, 07:05

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts