Menu

Simple Way for Condtional Compiling

bed
2017-10-05
2017-10-05
  • bed

    bed - 2017-10-05

    I'm building a Project which is been developed @ the StartPic18 Board, and some Hardware functions can only be tested @a prototype Borad, a mixture of breadbord and PCB .
    I want only one Code to maintain.
    My Idea is using something like

    #define StartP
    '#define Proto
    
    ' in Progran
    #ifdef StartP
    #config MCLRE=off
    #endif
    
    #ifdef StartP
    #define Potentiometer   PORTC.5
    #endif
    
    #ifdef Proto
    #define Potentiometer   PORTC.4
    #endif
    

    Or is there another Method not blowing the source such much?
    Maybe Scripts? That I do not understand correctly, I fear.

     
  • Anobium

    Anobium - 2017-10-06

    The easy way... create you own header and use the #include directive in your solution.

     
  • bed

    bed - 2017-10-06

    Yes indeed! why did not I get it myself?
    Once again a huge thanx from the stormy Germany

     
    • Anobium

      Anobium - 2017-10-06

      :-)

       

Log in to post a comment.