FB_DALIV2Sequencer
The function block FB_DALIV2Sequencer is used to implement light sequences with up to 50 interpolation points.
The core of this function block is a ramp block that drives over an adjustable time to individual brightness values defined in a table and then remains at this brightness value for a similarly definable time. After the dwell time the next value is then driven to. As already mentioned, the table arrSequenceTable consists of 50 entries with the values for nTargetValue (target value), tRampTime (time taken to reach the target value) and tProlongTime (dwell time at the target value). It is not absolutely necessary to use all 50 values. A 0 entry of all 3 values marks the end of a sequence. Beyond that it is possible using the nStartIndex input to have a light sequence begin at any desired place in the table. This allows several different light sequences to be programmed even within the 50 entries, the sequences being separated from one another by 0 entry elements:

Over the course of time sequence 1, for example, looks like the following (nStartIndex=1, nOptions.bit0=TRUE, see below for explanation):

Beyond that the function block can be switched "normally" on and off (On: maximum value of the lamps, Off: 0) and switched back and forth between "On" and "Off" using the bToggle input. However, none of the command inputs is active unless the bEnable input is TRUE. If it is reset to FALSE, no more commands are accepted and the light value retains its current state – even from a ramp.
![]() | As explained at the beginning, this function block is based on the FB_DALIV2Ramp. The ramp block tries to map the set ramp time as accurately as possible. Nevertheless it is necessary to query data from the DALI control gears both once and cyclically, which takes a different amount of time depending on the set PLC cycle time. Therefore inaccuracies in the ramp time cannot be ruled out. |
Inputs
VAR_INPUT
bEnable : BOOL := TRUE;
bOn : BOOL;
bOff : BOOL;
bToggle : BOOL;
bStart : BOOL;
nStartIndex : USINT := 0;
arrSequenceTable : ARRAY [1..nMaxSequenceValues] OF ST_DALIV2SequenceTable;
nOptions : DWORD := 0;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;
END_VAR
Name | Type | Description |
---|---|---|
bEnable | BOOL | The bOn, bOff, bToggle and bStart inputs are active as long as this input is TRUE. A negative state deactivates the inputs and resets the function block. |
bOn | BOOL | A rising edge directly switches nActualLevelMasterDevice to the maximum value. |
bOff | BOOL | A rising edge immediately switches nActualLevelMasterDevice to “0”. |
bToggle | BOOL | Switches the light state back and forth respectively between On (maximum value) and Off (0). |
bStart | BOOL | A positive edge starts a light sequence from the beginning defined under nStartIndex. |
nStartIndex | USINT | see bStart. |
arrSequenceTable |
| Light value table with the associated ramp and dwell times (see ST_DALIV2SequenceTable) |
nOptions | DWORD | Parameterization input. The setting (or non-setting) of the individual bits of this variable of the type DWORD has the following effect: |
Bit |
Description |
---|---|
0 |
not set: The function block ceases its activity following the expiry of a sequence. A new positive edge at bStart would be necessary for a sequence restart. |
1..31 |
-- reserved for future options -- |
Name | Type | Description |
---|---|---|
nAddr | BYTE | Address of the single device for individual control or of the group for group control |
eAddrType | Short address, group address or broadcast | |
nMasterDevAddr | BYTE | The address of the master device (reference device) for group and common switching operations |
tCycleActualLevelMasterDev | TIME | Cycle time required to read the current actual value in the background (see ACTUAL DIM LEVEL). So that the dimming of the lamps is not disturbed, reading always has the lowest priority. If the value is set to 0, reading is prohibited. |
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_KL6811Communication (KL6811) or FB_KL6821Communication (KL6821). |
Outputs
VAR_OUTPUT
nActualLevelMasterDev : BYTE;
nActualIndex : USINT;
bLight : BOOL;
bSequenceActive : BOOL;
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
nActualLevelMasterDev | BYTE | Current output value of the master device (always the respectively addressed device if eAddrType = eAddrTypeShort) |
nActualIndex | USINT | Reference to the current element in the sequence table. Once a sequence is finished (bSequenceActive = FALSE, see below), this output becomes "0". |
bLight | BOOL | This output is set as long as nActualLevelMasterDev is greater than "0". |
bSequenceActive | BOOL | On processing a sequence this output is set to TRUE. |
bBusy | BOOL | This output is always active as long as the processing of a command (bOn, bOff, bToggle or ramp) is active. |
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. Is reset to FALSE by the execution of a command at the inputs. |
nErrorId | UDINT | Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs (see error codes). |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_DALI from v3.4.3.0 |