User manual
mikroBasic PRO for PIC32
MikroElektronika
191
Name Spaces
Name space is a scope within which an identier must be unique. The mikroBasic PRO for PIC32 uses two distinct
categories of identiers:
1. Global variables are visible throughout the whole unit, from the place of declaration. Also. they can be
seen in other units, if they are declared above the Implementation section.
2. Local variables, parameters, types, function results - must be unique within the block in which they are
declared.
For example:
dim level as byte
sub procedure control(dim sens as byte)
dim location as byte
location = 1
sens = location
level = 123
end sub
sub procedure temperature
location = 0 ‘ ILLEGAL
sens = 23 ‘ ILLEGAL: redenition of sens
level = 95
end sub
Modules
In mikroBasic PRO for PIC32, each project consists of a single project le and one or more module les. The project le,
with extension .mbp32 contains information on the project, while modules, with extension .mbas, contain the actual
source code. See Program Organization for a detailed look at module arrangement.
Modules allow you to:
- break large programs into encapsulated modules that can be edited separately,
- create libraries that can be used in different projects,
- distribute libraries to other developers without disclosing the source code.
Each module is stored in its own le and compiled separately; compiled modules are linked to create an application. To
build a project, the compiler needs either a source le or a compiled module le for each module.
Include Clause
mikroBasic PRO for PIC32 includes modules by means of the include clause. It consists of the reserved word
include, followed by a quoted module name. Extension of the le should not be included.
You can include one le per include clause. There can be any number of the include clauses in each source le,
but they all must be stated immediately after the program (or module) name.