Electronic – What are chip name macros are available in the HI-TECH C compiler

hi-tech-compilermicrocontrollerpic

I am using the HI-TECH C compiler for the PIC16 Microcontroller, and I would like to conditionally compile different chunks of code depending on which specific microcontroller has been selected.

I know you can conditionally compile code with something like:

#if defined(MACRO1)  
    ... compile this code ... 
#elif defined(MACRO2) 
    ... compile this code ...
#endif

What I need to know is what pre-defined macros are available in the HI-TECH C compiler that will let me select on the specific microcontroller?

Best Answer

Page 98 of the HITEC C Manual lists all the pre-defined macros.

One of the entries is:

_CHIPNAME To indicate the specific chip type selected, e.g., _16F877

so you have, as other examples:

  • _16F88
  • _16F84A
  • _16F505
  • _16F777
  • _16F1823
  • ...

etc.