Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
program test
main:
' some instructions...
' simple endless loop using a label
my_loop:
 ' some instructions...
 ' now jump back to label _loop
goto my_loop
end.
Note: Although it might seem like a good idea to beginners to program by means of jumps and labels, you should 
try not to depend on it. This way of thinking strays from the procedural programming and can teach you bad 
programming habits. It is far better to use procedures and functions where applicable, making the code structure 
more legible and easier to maintain.
2.12 Procedures and Functions
Procedures and functions, referred to as routines, are self-contained statement blocks that can be called from 
different locations in a program. Function is a routine that returns a value upon execution. Procedure is a routine that 
does not return a value.
Once routines have been defined, you can call them any number of times. Procedure is called upon to perform a 
certain task, while function is called to compute a certain value.
Procedure declaration has the form:
sub procedure procedureName(parameterList)
 localDeclarations
 statements
end sub
where procedureName is any valid identifier, statements is a sequence of statements that are executed upon the 
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/02.htm (9 sur 12)05/11/2004 02:12:53










