Mikroelektronika MIKROE-350 Scheda Tecnica

Pagina di 526
Main Module
Every project in mikroBasic PRO for AVR requires a single main module file. The
main module is identified by the keyword 
program
at the beginning. It instructs the
compiler where to “start”.
After you have successfully created an empty project with Project Wizard, Code Edi-
tor will display a new main module. It contains the bare-bones of the program:
program MyProject
' main procedure
main:
' Place program code here
end.
Other than comments, nothing should precede the keyword 
program
. After the pro-
gram name, you can optionally place the 
include
clauses.
Place all global declarations (constants, variables, labels, routines, structures)
before the label 
main
.
Other Modules
Modules other than main start with the keyword 
module
. Newly created blank mod-
ule contains the bare-bones:
module MyModule
implements
end.
Other than comments, nothing should precede the keyword 
module
. After the mod-
ule name, you can optionally place the 
include
clauses.
Interface Section
Part of the module above the keyword implements is referred to as interface sec-
tion. Here, you can place global declarations (constants, variables, labels, routines,
structures) for the project.
Do not define routines in the interface section. Instead, state the prototypes of rou-
tines (from implementation section) that you want to be visible outside the module.
Prototypes must exactly match the declarations.
125
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroBasic PRO for AVR
CHAPTER 5