Task Syntax
The Task Editor provides a blank template for writing tasks. For tasks to work they must be written using the correct structure and syntax. Clicking the Test Compile icon checks the structure and syntax of your tasks and indicate the location of coding errors. Once you have created a task, it can be triggered in a number of ways such as setting an action from a button press, sensor detection, Start command or StartTask command.
Task Structure
A task is constructed using the following elements:
// |
The Double Forward Slash indicates a comment; all text to the end of the line is ignored. |
Name="device name" |
The Name command sets a name for the Device and will overwrite the name in the Job; "device name" is any alphanumeric string, spaces are OK, must be less than eighty characters and enclosed in double quotes. |
TaskN() |
The TaskN () command specifies a task number; N is any number from 1 to 8 (1 to 64 for time clocks). The brackets must appear after the number but do not contain any data. |
{ } |
The Task Code begins with the opening parentheses and ends with the closing parentheses after all data and functions are specified. |
Name="task name" |
The Name command sets a name for the Task; "task name" is any alphanumeric string, spaces are OK, must be less than eighty characters and enclosed in double quotes. |
Label: |
Creates a subroutine label within the task Label: is any alphanumeric string followed by a colon. It has no functional operation other than being a pointer that the code can refer to. A label has 4 rules:
|
Jump(AAAA) |
Jump to the memory or label, AAAA can be a label or a tilde memory location relative to the start of the task. |
NewVector(AAAA) |
Set the start location for the next time this task is run. AAAA can be a label or a memory location relative to the start of the task |
Null |
Every task runs from top to bottom unless a branch command causes it to deviate from this course. If a null is placed in the code the task will terminate as soon as it reaches this line. |
StartTask(N) |
Starts Task N within the device. |
CancelTask(N) |
Cancels a currently running task in this device, N is the task number. |
PauseTask(N) |
Pauses Task N at the point it has reached in its code. |
Task Variables
Area=N |
Sets the default Area number; N is 0 to 255. Default Area is 1. |
Join=N |
Sets the default Join level; N is 1 to 8 (or hex value for combined join bytes eg 0xFF). If the Join byte is not set then the value of 0xFF is used. |
Fade=S |
Sets the Fade time; S is zero to 1200 seconds in 0.1 second increments. If the fade time is not set then the default is 2.00 seconds. |
Enable=True |
Enables or Disables an Event; True to enable, anything else to disable. |
Task Commands
Preset(P=N,A=N,F=S,J=N) |
P is the Preset number, N is 0 to 170 NOTE: Case and order of parameters is not significant |
PresetOffset(A=N,O=N) |
A is the Area number, N is 0 to 254 |
Channellevel(A=N,F=S,J=N,C=N,L=N) |
A is the Area number, N is 0 to 254 |
Delay(S) |
Delay the next command, S is zero to 1200 seconds in 0.1 second increments |
Panic(A=N,F=S,J=N) |
Sets system to panic mode. |
Unpanic(A=N,F=S,J=N) |
Sets system back to pre-panic mode state. |
DyNet(X,X,X,X,X,X,X) e.g. |
DyNet Message, X is a byte, 7 bytes are required, X values are: * Decimal 0 to 255 or Hex, 0x00 to 0xFF * Sync byte is 0x1c for logical message or 0x5c for physical message * A is the Area number * OP is the Opcode * J is the join level * DC is the Device code * BN is the Box number * D1, D2, D3 are data bytes |
Start(0xlC,200,X,X,X,X,0xff) |
A passive command that listens to the network for defined values. An X is a wildcard. |