FB_DALIV2xSteinelLiveLinkMotionSensor

![]() | This function block FB_DALIV2xSteinelLiveLinkMotionSensor serves as an example and is not included in the library. The function block can be downloaded as an export file and imported into the desired project. Adjustments can be made as required. |
The function block FB_DALIV2xSteinelLiveLinkMotionSensor evaluates the measured brightness and the occupancy of the Steinel LiveLink DALI control device. This function block can also be used to initialize the DALI control device.
The DALI control device occupies a short address and contains 2 instances. Instance 1 contains the motion sensor, instance 0 the light sensor. The device does not fully comply with the IEC 62386 standard and uses a company-specific protocol instead.
A detected movement is sent as an event while the brightness is read cyclically. Each instance can be disabled individually as required.
Download the TwinCAT 3 PLCopenXML file: FB_DALIV2xSteinelLiveLinkMotionSensor.zip
Inputs
VAR_INPUT
bInitialize : BOOL := FALSE;
nAddr : BYTE;
(* Occupancy Sensor Parameters *)
bPIREnable : BOOL := TRUE;
nPIRMotion : BYTE := 4; (* 5 s + (nPIRMotion 5 s) *)
nPIRRepeat : BYTE := 6; (* 5 s + (nPIRRepeat 5 s) *)
nPIRVerificationLevel : BYTE := 1; (* standard *)
nPIRDetectionRange : BYTE := 255; (*(only for HF sensors) 100 % *)
(* Light Sensor Parameters *)
bLSEnable : BOOL := TRUE;
tLSCycleTime : TIME := T#1M;
END_VAR
Name | Type | Description |
---|---|---|
bInitialize | BOOL | The DALI control device is initialized via a positive edge at this input. The parameters are written to the DALI control device, which must be accessible via the short address nAddr. The output bInitializing is TRUE during initialization. |
nAddr | BYTE | Short address of the DALI control device |
bPIREnable | BOOL | Parameter: If this input is TRUE, the motion sensor (instance 1) is enabled. The occupancy sensor is disabled by FALSE. |
nPIRMotion | BYTE | Parameter: Sets the value for the Motion Timer. If no movement is detected, the status of the motion sensor is not changed until the Motion Timer has expired. The time is calculated based on the formula 5 s + nPIRMotion * 5 s. This means that times from 5 s to 21 min 20 s are possible. |
nPIRRepeat | BYTE | Parameter: Sets the value for the Repeat Timer. The motion sensor status is retransmitted after the Repeat Timer has expired, even if the status has not changed. The time is calculated based on the formula 5 s + nPIRRepeat * 5 s. This means that times from 5 s to 21 min 20 s are possible. |
nPIRVerificationLevel | BYTE | Parameter: The detection sensitivity can be adjusted (0: motion detection disabled, 1: very sensitive to 15: very insensitive). |
nPIRDetectionRange | BYTE | Parameter: If an HF sensor is used, the size of the detection range can be set (0: 0 % to 255: 100 %). |
bLSEnable | BOOL | Parameter: If this input is TRUE, the light sensor (instance 0) is enabled. The light sensor is disabled by FALSE. |
tLSCycleTime | TIME | Cycle time in which the current actual value of the light sensor is read. |
Further details on the parameters can be found in the IEC 62386 standard and the manufacturer's documentation.
Inputs/outputs
VAR_IN_OUT
stCommandBuffer : ST_DALIV2CommandBuffer;
END_VAR
Name | Type | Description |
---|---|---|
stCommandBuffer | ST_DALIV2CommandBuffer | Reference to the internal structure for communication with FB_KL6821Communication (KL6821). |
Outputs
VAR_OUTPUT
bInitializing : BOOL;
bError : BOOL;
nErrorId : UDINT;
nInputDeviceError : BYTE;
(* Occupancy Sensor *)
bPIROccupied : BOOL;
(* Light Sensor *)
nActualLightLevel : UINT;
END_VAR
Name | Type | Description |
---|---|---|
bInitializing | BOOL | This output is TRUE during initialization. |
bError | BOOL | This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. |
nErrorId | UDINT | Contains the command-specific error code of the most recently executed command (see error codes). |
nInputDeviceError | BYTE | The status of the DALI control device (INPUT DEVICE ERROR) is queried before the initialization. 0 means no error. The individual error numbers are manufacturer-specific. |
bPIROccupied | BOOL | This output indicates the status of the motion sensor. |
nActualLightLevel | UINT | This output indicates the actual value of the light sensor. |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4022.4 | Tc2_DALI from v3.6.2.0 |