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:

  • It is case sensitive

  • It must start with a letter

  • It cannot contain any spaces

  • The quotes and colon are required for the label itself but not for its reference. For example: BRZ Label.

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.
CancelTask and StartTask can be used together to restart a Task that is currently running.

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
A is the Area number, N is 0 to 254
F is the Fade time, S is zero to 1200 seconds in 0.1 second increments
J is the Join level, N is 1 to 8 (or hex value for combined join bytes eg 0xFF)

NOTE: Case and order of parameters is not significant

PresetOffset(A=N,O=N)

A is the Area number, N is 0 to 254
O is the Preset offset number

Channellevel(A=N,F=S,J=N,C=N,L=N)

A is the Area number, N is 0 to 254
F is the Fade time, S is zero to 1200 seconds in 0.1 second increments
J is the Join level, N is 1 to 8 (or hex value for combined join bytes eg 0xFF)
C is the Channel number, N is 1 to 255
L is the Channel level, N is 0 to 100

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.
A is the Area number, N is 0 to 254
F is the Fade time, S is zero to 1200 seconds in 0.1 second increments
J is the Join level, N is 1 to 8 (or hex value for combined join bytes eg 0xFF)

Unpanic(A=N,F=S,J=N)

Sets system back to pre-panic mode state.
A is the Area number, N is 0 to 254
F is the Fade time, S is zero to 1200 seconds in 0.1 second increments
J is the Join level, N is 1 to 8 (or hex value for combined join bytes eg 0xFF)

DyNet(X,X,X,X,X,X,X)

e.g.
DyNet(0x1C,A,D1,OP,D2,D3,J)
DyNet(0x5C,DC,BN,OP,D1,D2,D3)

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.
In this example we are looking for any message on the network that starts with 1C, ends with FF and is sent to Area 200

Task Examples

sb icon function local task 1 My First Sequential Task

interactive

sb icon function local task 2 My First Conditional Task

interactive