96 of 172
ZBasic Language Reference 89 ZX Microcontroller Family The second method of setting the heap limit is to specify the desired size of the heap using the directive Option HeapSize in your Main module or by using the compiler option –-heap-size. The heap limit is set by subtracting the specified value from the address one past the end of RAM. For devices that have external RAM, the end of RAM is determined at startup. If you have external RAM, you may specify that all of the external RAM should be used for the heap by specifying the heap size using the special values 65535 or &HFFFF. The final method for setting the heap limit is to specify an absolute address using the directive Option HeapLimit in your Main module or by using the compiler option –-heap-limit. This method is recommended for use only by advanced programmers who understand completely how memory is allocated in a ZBasic application. 3.28 Task Management The ZBasic System Library has several routines that are helpful for managing tasks including LockTask(), UnlockTask(), StatusTask(), ResumeTask(), RunTask() and ExitTask(). The latter four routines permit some advanced task management for special situations. One use of these routines is to implement a timeout on a task that is awaiting the completion of an event, e.g. an external interrupt or an input capture. Normally, when a task is set to wait for an event like these it will wait indefinitely.