Predefined Globals and Constants

To facilitate 8051 programming, the mikroC PRO for 8051 implements a number of predefined globals and constants.

All 8051 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 8051 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 8051 installation folder, or probe the Code Assistant for specific letters (Ctrl+Space in the Code Editor).

Predefined project level defines

mikroC PRO for 8051 provides a set of predefined project level defines that you can use in your project :

// Identifying the selected MCU for the project :
#ifdef AT89S8253
...
#endif

// Identifying the frequency value (in kHz) for which the project is built :
#if __FOSC__ == 80000
...
#endif

// Identifying mikroC PRO for 8051 compiler :
#ifdef __mikroc_pro_FOR_8051__
...
#endif

// Identifying the compiler version :
#if __mikroc_pro_FOR_8051_version__ == 350
...
#endif

// Identifying the 8051 architecture :
#ifdef __8051__ 
...
#endif

// Identifying the MCU manufacturer :
#ifdef __ATMEL__ 
...
#endif

#ifdef __SILABS__ 
...
#endif
Copyright (c) 2002-2013 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code