User manual
188
mikoBasic PRO for PIC32
MikroElektronika
Program Organization
mikroBasic PRO for PIC32 imposes strict program organization. Below you can nd models for writing legible and
organized source les. For more information on le inclusion and scope, refer to Modules and to Scope and Visibility.
Organization of Main Module
Basically, the main source le has two sections: declaration and program body. Declarations should be in their proper
place in the code, organized in an orderly manner. Otherwise, the compiler may not be able to comprehend the program
correctly.
When writing code, follow the model presented below. The main module should look like this:
program <program name>
include <include other modules>
‘********************************************************
‘* Declarations (globals):
‘********************************************************
‘ symbols declarations
symbol ...
‘ constants declarations
const ...
‘ structures declarations
structure ...
‘ variables declarations
dim Name[, Name2...] as [^]type [absolute 0x123] [external] [volatile] [register]
[sfr]
‘ procedures declarations
sub procedure procedure_name(...)
<local declarations>
...
end sub
‘ functions declarations
sub function function_name(...) as return_type
<local declarations>
...
end sub
‘********************************************************
‘* Program body:
‘********************************************************
main:
‘ write your code here
end.