User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
195
Nothing should precede the keyword program except comments. After the program name, you can optionally place
the uses clause.
Place all global declarations (constants, variables, types, labels, routines) before the keyword begin.
Other Units
Units other than main start with the keyword unit. Newly created blank unit contains the bare-bones:
unit MyUnit;
implementation
end.
Other than comments, nothing should precede the keyword unit. After the unit name, you can optionally place the
uses clause.
Interface Section
Part of the unit above the keyword implementation is referred to as interface section. Here, you can place global
declarations (constants, variables, labels and types) for the project.
You do not dene routines in the interface section. Instead, state the prototypes of routines (from implementation
section) that you want to be visible outside the unit. Prototypes must match the declarations exactly.
Implementation Section
Implementation section hides all irrelevant innards from other units, allowing encapsulation of code.
Everything declared below the keyword implementation is private, i.e. has its scope limited to the le. When you
declare an identier in the implementation section of a unit, you cannot use it outside the unit, but you can use it in any
block or routine dened within the unit.
By placing the prototype in the interface section of the unit (above the implementation) you can make the routine
public, i.e. visible outside of unit. Prototypes must match the declarations exactly.