Conditional Compilation |
|
A variable may be defined for conditional compilation which equates to a numeric value, such as for when you want to switch target processors in a C project. |
//use variables to simplify complicated compilation #DEFINE target 0 //0=PIC12F675 / 1=PIC16F88 #DEFINE debugme 1 //0=standalone / 1=debug //Use #IF and #ENDIF, nested as needed #IF target==0 #INCLUDE <12F675.h> #DEVICE ADC=10 #USE DELAY(CLOCK=4000000,RESTART_WDT) #USE FAST_IO(a) #FUSES wdt #ENDIF #IF target==1 #INCLUDE <16F88.h> #IF debugme==1 #DEVICE ICD=true #ENDIF #DEVICE ADC=10 #USE DELAY(CLOCK=4000000) #USE FAST_IO(a) #USE FAST_IO(b) #FUSES nowdt #ENDIF |
Any questions or comments?
This page last updated on
August 28, 2011