^18 - The Indicator Port

This port can be used to see the current state of the LED’s for banks of 8 buttons on the local device. The port can also be written to to turn LED’s on or off as required. The port contains a single byte value and each bit represents one LED.

This port does not have a "don’t care" value so any time you store to the port it will set the state of all 8 indicators in that bank. To edit a single indicator you are better off using the LEDOnOff() command.

Syntax

LDA ^18,x //Get the state of the indicators LEDS.
STA ^18,x //Edit the state of the indicators LEDS.
Where x is the bank of up to 8 indicators you to read/write.
^18,0 will give the state of buttons 1-8.
^18,1 will give the state of buttons 9-16.

Similar to the LEDOnOff() command, this port does not override the proximity sensor. Any values stored to this while a panel is asleep will not be seen until the device wakes up.

Examples

Example 1

These two tasks stores the state of the indicators when the panel goes to sleep so it can recall them when it wakes up keeping DND lit all the time.

Task1()     //Trigger on Proximity no motion instead of standard feature
{
LDA ^18,0       //Get the state of the indicators
STA ~10         //Store for later
LDA $DND_State  //Load the state of the do not distrub button
BNE DND_SET     //IF set branch, if not assume cleared.
LDA #0x00
STA ^18,0       //Turn off all indicators
NULL
DND_SET:
    LDA #0x20
    STA ^18,0   //Turn off 1-5, turn 6 on
    Null
}
Task2()     //Trigger on Proximity motion instead of standard feature
{
LDA ~10       //Load the previous state of the indicators
STA ^18,0     //Update the indicators
NULL
}

Example 2

This task checks the state of a single indicator using the AND command.

{
LDA ^18,0       //Load the first 8 indicators
AND #0x04       //AND it with 0x04 and mask out all but indicator 3
BRZ LED3OFF     //If Off branch, if not assume On
...
}