User`s manual

In mikroBasic, use the keyword Result to assign the return value of a function.
Example:
dim locS as word
locS = par1 + par2
Result = locS
end sub
As functions return a value, function calls are technically expressions. For exam-
ple, if you have defined a function called Calc, which collects two integer argu-
ments and returns an integer, then the function call
Calc(24, 47) is an integer
expression. If I and J are integer variables, then I + Calc(J, 8) is also an inte-
ger expression. Here are a few examples of function calls:
Sum(tA,63)
Maximum(147,J)
GetValue
Note that cross-calling and recursive calls are not allowed in mikroBasic. Cross-
calling is an instance of procedure A calling procedure B, and then procedure B
calling procedure A. Recursive call is an instance of procedure or function calling
itself. Compiler will report error if cross-calling or recursive calls are encountered
in the code.
mikroBasic has a number of built-in and predefined library routines. For example,
procedure
interrupt is the interrupt service routine.
Nested calls are limited to 8-level depth for PIC16 series and 31-level depth for
PIC18 series. Nested call represent call of another function or procedure within a
function or procedure. For closer information, refer to the chapter PIC Specifics.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
52
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
making it simple...
Function Calls
Important
sub function pr6_function(dim par1 as byte, dim par2 as word) as word