Predefined Globals and Constants

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

All ARM SFRs are implicitly declared as global variables of volatile longword. These identifiers have an external linkage, and are visible in the entire project. When creating a project, the mikroBasic PRO for ARM will include an appropriate (*.mbas) file from defs folder, containing declarations of available SFRs and constants (such as GPIO_PORTB, etc).

For a complete set of predefined globals and constants, look for “Defs” in the mikroBasic PRO for ARM installation folder, or probe the Code Assistant for specific letters (Ctrl+Space in the Code Editor).

Predefined project level defines

mikroBasic PRO for ARM provides predefined project level defines that you can use in your project, for example :

General predefined constants :

' Family name :
#IFDEF ARM
...
#ENDIF

' M3 core family :
#IFDEF ARM_M3
...
#ENDIF

' M4 core family :
#IFDEF ARM_M4
...
#ENDIF

' MCU name :
#IFDEF LM3S9B95
...
#ENDIF

' Hardware Debug build type :
#IFDEF HW_DEBUG
...
#ENDIF

Stellaris specific predefined constants :

' LuminaryMicro family :
#IFDEF LM
...
#ENDIF

' LuminaryMicro subfamily M3 core :
#IFDEF LM3
...
#ENDIF

' LuminaryMicro MCU series (LM3S1000 - LM3S9000) :
#IFDEF LM3S1000
...
#ENDIF
...
#IFDEF LM3S9000
...
#ENDIF

ST specific predefined constants :

' ST device :
#IFDEF STM32
...
#ENDIF

' STM32F1XX device :
#IFDEF STM32F1XX
...
#ENDIF

' STM32F2XX device :
#IFDEF STM32F2XX
...
#ENDIF

' STM32F4XX device :
#IFDEF STM32F4XX
...
#ENDIF

' STM32L1XX device :
#IFDEF STM32L1XX
...
#ENDIF
Copyright (c) 2002-2012 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