Due to the structure of the resulting assembly file and the PIC18 architecture there are a few limiting factors that the programmer needs to keep in mind.
Due to the way local variables are allocated without a real software stack Basic18 procedures are not reentrant, therefore recursion is not possible.
There are three threads of execution possible on the PIC18
A procedure called from one of these threads can not be called by another thread. This includes library routines explicitly called by the user, or automatically called by the compiler.
The compiler will call library routines to perform the following operations, therefore these operations are only allowed in one thread of execution.
|
Because Basic18 takes advantage of the advanced instruction set of the PIC18 for generating comparisons, the amount of code contained inside some control structures are limited to 127 bytes. The compiler will not generate an error for this, however the assembler will generate errors when the program is assembled.
Code space between If Then and the End If can not exceed 127 bytes.
Code between If Then and Else can not exceed 127 bytes.
Code between While and End While can not exceed 127 bytes
When assigning the contents of one boolean variable to another, both variables MUST be in the same RAM Bank.