'XC16 MCU family macros
To detect a single MCU with XC16 we can use the defines such as __dsPIC33EP128MC202__, but what are the defines for a family such as dsPIC33E?
When googeling I find references to __PIC24F__ etc, but none of them are defined within XC16. I can't find any define related to a whole family, only specific MCU:s.
I know I can add my own define to the project, but that would involve the human factor, remembering to set/update it correctly on each project. I figured if __PIC24F__ is defined in a XC compiler, then XC16 would logically have the same system.
Solution 1:[1]
#if defined(__dsPIC33E__)
works for me. In a central header file I Have this :
#if defined(__dsPIC33F__)
#include "p33fxxxx.h"
#elif defined(__dsPIC33E__)
#include "p33exxxx.h"
#elif defined(__PIC24F__)
#include "p24fxxxx.h"
#endif
I think I got this from Microchips MLA libraries. I assume there is also a -H. I do work with dspic33C, but that is a different codebase/repo since the peripherals are generally different
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marco van de Voort |
