^17 - The Dry Contact Port

This read only port contains the state of all the dry contact and aux inputs on a device in banks of 8. The value is a bitfield with each contact represented by a single bit.

As this port contains the state of more than one input you may need to use the AND command to isolate a single input or the SHR command to check them one at a time.

Syntax

LDA ^17,x
Where x is the bank of dry contacts you want the status of.
LDA ^17,0 will give the state of dry contacts 1-8.
LDA ^17,1 will give the state of dry contacts 9-16.

The aux input of a load controller will be the bit. That means that dry contact 8 on a DDMC802 is actually the 9th value (bit 1 of the second bank).

Examples

Example 1

Example showing using SHR to interrogate one dry contact at a time.

Task1()
{
    Name="Occupancy Trigger"    //Checks the state of dry contact 3.
    LDA ^17,0           //Get the dry contact port
    SHR                 //Move dry contact 1 into the carry flag
    SHR                 //Move dry contact 2 into the carry flag
    SHR                 //Move dry contact 3 into the carry flag
    BRC Occupancy       //If carry flag is set sensor saw motion
    ...
}

Example 2

{
LDA ^17,0           //Load the first 8 dry contacts
AND #0x04           //AND it with 0x04 and mask out all but input 3
BRZ Switch3Released //If released branch, if not assume pressed
...
}

Example 3

{
LDA ^17,2       //Load the third set of 8 dry contacts
AND #0x02       //AND it with 0x02 and mask out all but second bit (DC#18)
BNE DC18Pressed //If pressed branch, if not assume released
...
}