Datasheet
PREDEFINED GLOBALS AND CONSTANTS
In order to facilitate AVR programming, mikroBasic PRO for AVR implements a num-
ber of predefined globals and constants.
SFRs and related constants
All AVR SFRs are implicitly declared as global variables of volatile word type.
These identifiers have an external linkage, and are visible in the entire project.
When creating a project, the mikroBasic PRO for AVR will include an appropriate
(*.mbas) file from defs folder, containing declarations of available SFRs and con-
stants (such as PORTB, ADPCFG, etc). All identifiers are in upper case, identical to
nomenclature in the Microchip datasheets.
For a complete set of predefined globals and constants, look for “Defs” in the
mikroBasic PRO for AVR installation folder, or probe the Code Assistant for specific
letters (Ctrl+Space in the Code Editor).
Math constants
In addition, several commonly used math constants are predefined in mikroBasic
PRO for AVR:
PI = 3.1415926
PI_HALF = 1.5707963
TWO_PI = 6.2831853
E = 2.7182818
Predefined project level defines
These defines are based on a value that you have entered/edited in the current proj-
ect, and it is equal to the name of selected device for the project.
If ATmega16 is selected device, then ATmega16 token will be defined as 1, so it can
be used for conditional compilation:
#IFDEF ATmega16
...
#ENDIF
Related topics: Project level defines
89
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Specifics
mikroBasic PRO for AVR
CHAPTER 3