^34 - The Motion Sensor Port

This port is a read only value of the current state of the motion sensors.
It does not report a raw value, only a binary state of motion detected or no motion.

This is a read only port on sensors but you can actually write to it as well in dry contact interfaces like the DLLI8I8O, DPMI940, and DDMIDC8. This port also works on a DALI controller to read the state of the DALI motion sensors on the bus.

Syntax

LDA ^34,x
Where x is the detector number or sensor number on DALI controller or Dry Contact interface
LDA ^34,0 //Reports the state of the first sensor(Typically PIR)
LDA ^34,1 //Reports the state of the second sensor(Typically Ultrasonic)
LDA ^34,5 //Reports the state of the fourth sensor (DLLI8I8O Motion Tab #4)

^34 Motion Sensor port responses

No Motion Detected

0

Motion Detected

1

Sensor Disabled

2

Detector Value Invalid

3

Sensor Offline

4

This will report the detector state even if in a preset with no motion events or when motion control is disabled for the area.

Examples

Example 1

This task only sends a message if the room is unoccupied.

Task1()
{
LDA ^34,0      //Get the motion state
BRZ NoMotion   //If no motion branch, if motion just end
NULL
NoMotion:
    Preset(A=11,P=1,F=2)    //Turn on the balcony lights to make the building look busy.
    Null
}

Example 2

This task excerpt polls the state of motion sensors on a DALI controller.
The task template "Occupancy - Dali Sensors" is packaged with System Builder.

...
MotionCheckSensor1:										//Check Sensor 1
    LDA ^34,0 											//read current motion activity from motion port
    CMP #1												//Was Motion Detected
    BRZ UpdateMotionDetectedFlagSensor1					//If so BRA to Label: UpdateMotionDetectedFlagSensor1
    CMP #2												//is Motion Disabled
    BRZ StopReporting 									//If So BBranch to label: StopReporting
	BRA IncrementSensorThenCheckMotionPort

MotionCheckSensor2:										//As per above Sensor 2 Check
    LDA ^34,1 											//read current motion activity from motion port
    CMP #1
    BRZ UpdateMotionDetectedFlagSensor2
    CMP #2
    BRZ StopReporting
	BRA IncrementSensorThenCheckMotionPort
...