FB_DALIV2Light
The function block FB_DALIV2Light is a simple function block for switching DALI lamps on and off.
Operation
A positive edge applied to the bOn input will switch the light to the maximum value (MAX LEVEL) of the control gear. If the function block is executed successfully, the bLight output is set to TRUE. Applying a positive edge to the bOff input will switch the light off, and the bLight output will be set to FALSE. If a positive edge is applied to bToggle, the function block first reads the current light value from the master device, and then decides whether the status of the lamp is on or off. Once this decision has been reached, the lamp is then placed into whatever the other state is, i.e. it is switched from on to off or from off to on.
Comment on the nMasterDevAddr parameter
The DALI system provides facilities not just for controlling lamps individually, but also for addressing them as groups or through common commands. Since the individual devices may belong to different groups, the individual lamps may have different brightness states before a group or common control command. So that it is nevertheless possible to be clear whether the lamps now are to be switched on or off, a master device is assigned to each group, whose state is followed by the other devices. It is not necessary to specify a master device if the function block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.
Inputs
VAR_INPUT
bOn : BOOL;
bOff : BOOL;
bToggle : BOOL;
nAddr : BYTE := 0;
eAddrType : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;
END_VAR
Name | Type | Description |
---|---|---|
bOn | BOOL | Switches the addressed devices on (to the value MAX LEVEL). |
bOff | BOOL | Switches the addressed devices off (value 0). |
bToggle | BOOL | Negates the status of the addressed devices. |
nAddr | BYTE | The address of a device or of a group |
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_INPUT
bLight : BOOL;
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bLight | BOOL | The status of the lamp or group after the function block has been called |
bBusy | BOOL | When the function block is activated the output is set, and it remains active until execution of the command has been completed. |
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 |