FB_DALIV2Light

FB_DALIV2Light 1:

The FB_DALIV2Light() block is a simple 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 ballast. 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.

Parameter nMasterDevAddr

The DALI system provides facilities not just for controlling lamps individually, but also for addressing them as groups or through common commands. Because the individual devices can be members of a variety of groups, it can happen that, prior to the issue of a group or common control command, the individual lamps have different brightness levels. 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.

VAR_INPUT

bOn                        : BOOL;
bOff                       : BOOL;
bToggle                    : BOOL;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;

bOn: Switches the addressed devices on (to the value MAX LEVEL).

bOff: Switches the addressed devices off (to value 0).

bToggle: Reverses the status of the addressed devices.

nAddr: The address of a participating device or of a group.

eAddrType: Short address, group address or broadcast.

nMasterDevAddr: The address of the master device for group and common switching operations.

tCycleActualLevelMasterDev: Cycle time required to read the current actual value (ACTUAL DIM LEVEL) in the background. 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.

VAR_OUTPUT

bLight             : BOOL;
bBusy              : BOOL;
bError             : BOOL;
nErrorId           : UDINT;

bLight: The status of the lamp or group after the block has been called.

bBusy: When the block is activated the output is set, and it remains active until execution of the command has been completed.

bError : This output is switched to TRUE if 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 an instruction at the inputs.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of an instruction at the inputs. See Error codes.

VAR_IN_OUT

stCommandBuffer        : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication with the FB_DALIV2Communication() (KL6811) or FB_KL6821Communication() (KL6821) block.