^22 - The Task Start Port
This port is a read only value of the last way a task on the device was started.
Syntax
LDA ^22,x
Where x is the task number (base 0) that you want to know how it last started.
LDA ^22,0 is task 1.
LDA ^22,1 is task 2.
LDA ^22,255 is the requesting task.
Response |
Source Description |
0x00 |
Don’t Know |
0x01 |
Started by another task |
0x02 |
Started by an event |
0x03 |
Physical OpCode 0x10 message From Port 1 (Spur) |
0x04 |
Physical OpCode 0x10 message from Port 2 (Trunk) |
0x05 |
Started by a Button |
0x06 |
Started by a Dry Contact |
0x07 |
Started by an Aux Input |
0x08 |
Started by a Start() message trigger |
0x09 |
Started by a tamper switch action |
0x0a |
Started by an on-motion action |
0x0b |
Started by a on-no-motion action |
0x0c |
Is the Startup Task |
0x0d |
Started by crossing a Lux Threshold |
0x0e |
Started by an IR Button action |
0xFF |
Task does not exist |
Port ^16,0 will tell you what port the logical messages was received on that triggered a Start() command. 0x00=Internal, 0x02=Spur, 0x05=Trunk |
Example
Using the port to communicate where it triggered from.
Task1()
{
Start(A=100,P=1) //Start on P1 for A100
LDA ^22,255 //Load what started the task
BRZ DontKnow
CMP #0x01 //Local trigger from StartTask command?
BRZ OtherTask
CMP #0x03 //External trigger using 0x5c opcode 0x10?
BRZ PhysicalMSG
CMP #0x05 //Started by button press?
BRZ ButtonPress
CMP #0x08 //Logical trigger using Start() command?
BRZ StartCommand
Null
StartCommand:
LDA ^16,0 //Load where the message came from
BRZ DyNetMute //If 0 it was an internal message from TX command
CMP #0x02 //Was it from the spur?
BRZ SpurMsg
CMP #0x05 //Was it from the trunk?
BRZ TrunkMsg
Null
...
}