ZBasic Language Reference
33
ZBasic Microcontrollers
Examples
Call PutPin(12, 0)
PutPin 12, 0
Delay (1.0)
2.5.3 CallTask Statement
The CallTask statement is used to start a task. See Section 3.5 for more information on using tasks. The
basic syntax to invoke a task is:
CallTask <task-name>, <task-stack>
In this case, the <task-name> element must be the name of a user-defined subroutine (usually one that
takes no parameters). The <task-stack> must be the name of a Byte array that will serve as the stack
for the task. For compatibility with BasicX, the <task-name> may be enclosed in quote marks.
Example
Dim ts1(1 to 40) as Byte
CallTask task1, ts1
A task may also be passed parameters when it is invoked. The syntax for doing so is similar to that for
invoking a subroutine that requires parameters.
CallTask <task-name>( <parameter-list> ), <task-stack>
See the discussion of the CallTask statement in the ZBasic System Library Reference manual for more
details on the allowed parameter types. This syntax is not supported in BasicX compatibility mode.
Example
Dim ts1(1 to 40) as Byte
CallTask task1(&H100), ts1
For advanced users, the task stack may also be specified by giving its address explicitly. This topic is
discussed in section 3.5.1, Advanced Multi-tasking Options.
2.5.4 Console.Write and Console.WriteLine Statements
These statements (with a syntax more akin to object-oriented methods) are similar to Debug.Print but
they are limited to displaying one string at a time. They are supported for compatibility with Visual Basic.
The syntax of the statements is:
Console.Write( <string-expression> )
Console.WriteLine( <string-expression> )
The difference between these two statements is that the latter also outputs a carriage return/line feed
following the string while the former does not.
|