Predefined Globals and Constants
To facilitate AVR programming, the mikroC PRO for AVR implements a number of predefined globals and constants.
All AVR SFR registers and their bits are implicitly declared as global variables. These identifiers have an external linkage, and are visible in the entire project. When creating a project, the mikroC PRO for AVR will include an appropriate (*.c) file from defs folder, containing declarations of available SFR registers and constants.
For a complete set of predefined globals and constants, look for “Defs” in the mikroC PRO for AVR installation folder, or probe the Code Assistant for specific letters (Ctrl+Space in the Code Editor).
Predefined project level defines
mikroC PRO for AVR provides several predefined project level defines that you can use in your project :
- First one is equal to the name of selected device for the project i.e. if ATmega16 is selected device, then ATmega16 token will be defined as 1, so it can be used for conditional compilation:
#ifdef ATmega16 ... #endif
#ifdef __FOSC__ == 80000 ... #endif
#ifdef __mikroc_pro_FOR_avr__ ... #endif
#if __mikroc_pro_FOR_avr_BUILD__ == 142 ... #endif
User can define custom project level defines.
What do you think about this topic ? Send us feedback!