Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Introduction

DALI (Digital Addressable Lighting Interface) is a definition whose purpose is to standardise digital interfaces to lamp ballasts. The standard (IEC 62386) allows the manufacturers of lighting components to implement complex lighting tasks easily and conveniently.

The KL6811 Bus Terminal (DALI Master) is integrated into the Bus Terminal system as a normal Bus Terminal, and is therefore independent of the fieldbus in use. The DALI data is then passed on to the ballasts through the relevant Bus Coupler. Bus controllers also offer a facility for distributed execution of PLC programs in IEC61131-3.

The present version of the DALI library replaces the former version of the DALI library. You will find the older DALI library, with instructions, under TcPlcLibDALIV1.zip. You should only use the current version for newer projects, as the old version will no longer be further developed.

System properties

DALI is defined for:

  • a maximum of 64 individual devices
  • a maximum of 16 groups
  • a maximum of 16 scenes

The intelligence in the DALI system is not 100% centralised. This means that a large number of settings and light intensities are stored in the ballast in the form of variables.

  • Short address
  • Association with a group
  • Lighting scene values
  • Fade rate
  • Emergency power lighting level
  • Initial power level on return of voltage

Note

In accordance with IEC 62386 a DALI master must repeat certain commands within 100 ms if they are to be executed by the DALI slaves. In order to avoid the need for calling the commands twice in the user program, the KL6811 repeats certain commands automatically. You will find a list of the commands that are automatically repeated by the terminal in the appendix to the documentation for the KL6811.

Further information about DALI may be found on the website of the DALI Activity Group (http://www.dali-ag.org) and in the IEC 62386 standard.


Dimming curve

Because the human eye reacts with extreme sensitivity, particularly when the level of illumination is low, irregular or jerky changes in the illumination level, and even linear modifications, are felt to be unpleasant. For this reason, the dimming characteristic of a DALI lighting installation follows a logarithmic dimming curve based on the sensitivity of the human eye.

The dimming curve is calculated according to this formula:
n: 8-bit control value
X: Lamp power value in %

The following dimming curve results:


General information

Note 		Installation
Beginning with TwinCAT 2.11 Build 2229 (R3 and x64 Engineering), the libraries "TcDALIV2.lib/.lb6/.lbx" will be installed automatically.

Hardware documentation in Beckhoff Information System: KL6811 - Master Terminal for DALI/DSI

Further libraries are required

For PC systems (x86) and Embedded-PCs (CXxxxx):

  • Standard.lib
  • TcBase.lib
  • TcSystem.lib

For Bus Terminal Controller of BCxx00 series:

  • Standard.lb6
  • TcPlcUtilitiesBC.lb6
  • PlcHelperBC.lb6
  • PlcSystemBC.lb6

For Bus Terminal Controller of BCxx50, BCxx20 and BC9191 series:

  • Standard.lbx
  • TcBaseBCxx50.lbx
  • TcSystemBCxx50.lbx

For Bus Terminal Controller of BXxx00 series:

  • Standard.lbx
  • TcBaseBX.lbx
  • TcSystemBX.lbx

Note 		Memory usage
By linking the library PLC program memory is already consumed. Depending on the application program the remaining memory can not be sufficient.


Integration into TwinCAT (CX9020)

This example explains how to write a simple PLC program for DALI in TwinCAT and how to link it with the hardware. The task is to control an individual dimmable lamp via a button.

Unpacking the example files

Hardware

Setting up the components

The following hardware is required:

  • 1x Embedded PC CX9020
  • 1x digital 2-channel input terminal KL1002 (for the dimming and reset functions)
  • 1 DALI terminal KL6811
  • 1x end terminal KL9010

Set up the hardware and the DALI components as described in the associated documentation.

This example assumes that a Dim button was connected to the first KL1002 input and a Reset button to the second, and that a dimmable lamp is connected to DALI address 0. Set the initial fade rate of the ballast to 7 to achieve suitable dimming.

Software

Creation of the PLC program

Create a new PLC project for PC-based systems (ARM) and add the TcDALIV2.lib library.

Next, generate the following global variables:

VAR_GLOBAL
    bSwitch          AT %I* : BOOL;
    bReset           AT %I* : BOOL;
    stDALIInData     AT %I* : ST_DALIV2InData;
    stDALIOutData    AT %Q* : ST_DALIV2OutData;
    stCommandBuffer         : ST_DALIV2CommandBuffer;
END_VAR

bSwitch: Input variable for the Dim button.

bReset: Input variable for the Reset button.

stDALIInData: Input variable for the DALI terminal.

stDALIOutData: Output variable for the DALI terminal.

stCommandBuffer : Required for the communication with DALI.

Then create a program (CFC) for background communication with DALI. The FB_DALIV2Communication block is called in this program. Make sure to link the communication block with stDALIInData, stDALIOutData and stCommandBuffer.

Create a MAIN program (CFC) in which the block FB_DALIV2Dimmer1Switch is called up. Connect the input bSwitchDimm of the dimmer block with the global variable bSwitch and stCommandBuffer with the global variable stCommandBuffer.

Notice 		Parameter
Make sure that the specified parameters nMinlevelMasterDevice and nMaxLevelMasterDevice match the minimum and maximum values of the device, in order to avoid malfunction.

Under Task Configuration create a new task for the background communication. Add the communication program to this task. Assign a higher priority (lower number) and shorter interval time to this task than for the standard task. More detailed information can be found in the FB_DALIV2Communication block description.

Load the project to the CX as the boot project and save it.

Configuration in the System Manager

Create a new System Manager project, select the CX as the target system, and search for the associated hardware.

Add the PLC program created above under PLC configuration. The two tasks are listed when the PLC project is expanded in the tree view. Expand the tasks – all global input and output variables should be allocated to the standard task. However, since the variables stDALIInData and stDALIOutData are to be processed faster, move them to the background communication task via drag & drop.

Now link the global variables of the PLC program with the Bus Terminal inputs and outputs, create the allocations, and activate the configuration. Then start the device in run mode.
Your CX is now ready for use.

The lamp can now be controlled by pressing or holding the dimmer button. Use the Reset button to reset the entries in arrBufferMaximumDemandMeter and arrBufferOverflowCounter.


Integration into TwinCAT (BC9191)

This example explains how to write a simple PLC program for DALI in TwinCAT and how to link it with the hardware. The task is to control an individual dimmable lamp via a button.

Unpacking the example files

Hardware

Setting up the components

The following hardware is required:

  • 1x Bus Terminal Controller BC9191
  • 1x potential feed terminal 24V DC
  • 1x digital 2-channel input terminal KL1002 (for the dimming and reset functions)
  • 1 DALI terminal KL6811
  • 1x end terminal KL9010

Set up the hardware and the DALI components as described in the associated documentation.

This example assumes that a Dim button was connected to the first KL1002 input and a Reset button to the second, and that a dimmable lamp is connected to DALI address 0. Set the initial fade rate of the ballast to 7 to achieve suitable dimming.

Software

Creation of the PLC program

Create a new PLC project for BC-based systems (BCxx50 via AMS) and add the libraries TcDALIV2.lbx and TcSystemBCxx50.lbx. Then navigate to Project → Options... → Build and select Treat LREAL as REAL.

Next, generate the following global variables:

VAR_GLOBAL
    bSwitch          AT %I* : BOOL;
    bReset           AT %I* : BOOL;
    stDALIInData     AT %I* : ST_DALIV2InData;
    stDALIOutData    AT %Q* : ST_DALIV2OutData;
    stCommandBuffer         : ST_DALIV2CommandBuffer;
END_VAR

bSwitch: Input variable for the Dim button.

bReset: Input variable for the Reset button.

stDALIInData: Input variable for the DALI terminal.

stDALIOutData: Output variable for the DALI terminal.

stCommandBuffer : Required for the communication with DALI.

Since BC devices can only process one task, communication with DALI cannot run separately.

Therefore, create a MAIN program (CFC) in which the FB_DALIV2Communication and FB_DALIV2Dimmer1Switch function blocks are called. Make sure to link the communication block with stDALIInData, stDALIOutData and stCommandBuffer.

Connect the input bSwitchDimm of the dimmer block with the global variable bSwitch and stCommandBuffer with the global variable stCommandBuffer.

Notice 		Parameter
Make sure that the specified parameters nMinlevelMasterDevice and nMaxLevelMasterDevice match the minimum and maximum values of the device, in order to avoid malfunction.

Go to the task configuration and give the task a lower interval time. More detailed information can be found in the FB_DALIV2Communication block description.

Now load the project as a boot project to the BC and save it.

Configuration in the System Manager

Create a new System Manager project, select the BC as the target system, and search for the associated hardware.

Add the PLC program created above under PLC configuration.

Now link the global variables of the PLC program with the Bus Terminal inputs and outputs, create the allocations, and activate the configuration. Then start the device in run mode.
Your BC is now ready for use.

The lamp can now be controlled by pressing or holding the dimmer button. Use the Reset button to reset the entries in arrBufferMaximumDemandMeter and arrBufferOverflowCounter.


Variables

Every DALI ballast has a certain number of variables (parameters ) from which it is possible to read a variety of information or to modify individual parameters.

Name | Default value | Reset value | Valid range | Size | Comment
ACTUAL DIM LEVEL | ? | 254 | 0, MIN LEVEL ... MAX LEVEL | 1 byte |
POWER ON LEVEL | 254 | 254 | 1 ... 254 | 1 byte |
SYSTEM FAILURE LEVEL | 254 | 254 | 0 ... 255 | 1 byte |
MIN LEVEL | PHYSICAL MIN LEVEL | PHYSICAL MIN LEVEL | PHYSICAL MIN LEVEL ... MAX LEVEL | 1 byte |
MAX LEVEL | 254 | 254 | MIN LEVEL ... 254 | 1 byte |
FADE RATE | 7 | 7 | 1 ... 15 | 1 byte |
FADE TIME | 0 | 0 | 0 ... 15 | 1 byte |
SHORT ADDRESS | 255 | No change | 0 ... 63, 255 | 1 byte |
SEARCH ADDRESS | FF FF FF | FF FF FF | 00 00 00 ... FF FF FF | 3 bytes |
RANDOM ADDRESS | FF FF FF | FF FF FF | 00 00 00 ... FF FF FF | 3 bytes |
GROUP 0-7 | 0 | 0 | 0 ... 255 | 1 byte |
GROUP 8-15 | 0 | 0 | 0 ... 255 | 1 byte |
SCENE 0 | 255 | 255 | 0 ... 255 | 1 byte |
... | ... | ... | ... | ... |
SCENE 15 | 255 | 255 | 0 ... 255 | 1 byte |
STATUS INFORMATION | ???? ???? | 0?10 0??? | 0 ... 255 | 1 byte | read only
VERSION NUMBER | Manufacturer-dependent | Manufacturer-dependent | 0 ... 255 | 1 byte | read only
DEVICE TYPE | Manufacturer-dependent | Manufacturer-dependent | 0 ... 255 | 1 byte | read only
PHYSICAL MIN LEVEL | Manufacturer-dependent | Manufacturer-dependent | 1 ... 254 | 1 byte | read only

?: Not specified

ACTUAL DIM LEVEL

This variable contains the power currently applying to the lamp.
The value can be read with the FB_DALIV2QueryActualLevel() block.

POWER ON LEVEL

When power is supplied to the ballast the lamp is driven to the level of power specified in the variable POWER ON LEVEL. This assumes that the DALI bus has already been supplied with power and is idle. The range of values available to POWER ON LEVEL is restricted by the two variables MIN LEVEL and MAX LEVEL.
The variable can be read with the FB_DALIV2QueryPowerOnLevel() block, and written with FB_DALIV2StoreDTRAsPowerOnLevel().

SYSTEM FAILURE LEVEL

If a fault occurs on the DALI bus (the idle voltage remains below the specified level for longer than 500 ms) then the lamp is driven to the power specified by the SYSTEM FAILURE LEVEL variable. If the variable contains 255 (mask) the lamp power will not change. The possible range is limited by MIN LEVEL and MAX LEVEL.
The variable can be read with the FB_DALIV2QuerySystemFailureLevel() block, and written with FB_DALIV2StoreDTRAsSystemFailureLevel().

MIN LEVEL / MAX LEVEL

The ballast internally restricts the value of the output power to the lamp by means of the MIN LEVEL and MAX LEVEL variables. The exceptions to this are power values of 0 (off) and 255 (mask).

FADE RATE

The FADE RATE specifies the rate at which changes are made (in steps per second) in the value of the lamp's power. This variable has an effect on the FB_DALIV2Up() and FB_DALIV2Down() commands. The absolute fade rate is not entered directly, but it is calculated according to the following formula:

T = absolute fade rate
n = value that is stored in the FADE RATE variable

The following values result:

n | absolute fade rate
0 | Not permitted
1 | 357,796 steps/s
2 | 253.000 steps/s
3 | 178,898 steps/s
4 | 126,500 steps/s
5 | 89,449 steps/s
6 | 63,250 steps/s
7 | 44,725 steps/s
8 | 31,625 steps/s
9 | 22,362 steps/s
10 | 15,813 steps/s
11 | 11,181 steps/s
12 | 7,906 steps/s
13 | 5,591 steps/s
14 | 3,953 steps/s
15 | 2.795 steps/s

FADE TIME

The FADE TIME specifies the time allowed for the current lamp power to be changed to the requested value. In the case of a lamp that is switched off, the pre-heating and ignition time is not included in the fade time. The FB_DALIV2DirectArcPowerControl() and FB_DALIV2GoToScene() blocks are affected. The absolute fade time is not entered directly, but it is calculated according to the following formula:

T = absolute fade time
n = value that is stored in the FADE TIME variable

The following values result:

n | absolute fade time
0 | < 0.707 s
1 | 0,707 s
2 | 1.000 s
3 | 1,414 s
4 | 2.000 s
5 | 2,828 s
6 | 4.000 s
7 | 5,657 s
8 | 8.000 s
9 | 11,314 s
10 | 16.000 s
11 | 22,627 s
12 | 32.000 s
13 | 45,255 s
14 | 64.000 s
15 | 90.510 s

SHORT ADDRESS

The short address is stored in this variable. A valid short address lies in the range between 0 and 63. The short address is regarded as having been deleted if 255 is written to the variable. The short address can be set with the FB_DALIV2SetShortAddress() and FB_DALIV2StoreDTRAsShortAddress() blocks. Calling the FB_DALIV2QueryMissingShortAddress() queries whether a ballast still does not have a short address.

SEARCH ADDRESS

The search address is only needed when assigning short addresses.

RANDOM ADDRESS

The random address, also called the long address, is specified by the manufacturer when the ballasts are supplied. The FB_DALIV2QueryRandomAddress() block can be used to read out the 3 bytes of the random address.

GROUP 0-7 / GROUP 8-15

16 groups exist within a DALI network. Any ballast can belong to one group, to several, or indeed to none. Commands that are to be sent to a group have an effect on all the ballasts that belong to that particular group. The FB_DALIV2QueryGroups() block reads both 8-bit variables and assembles them into a single 16 bit value. Each bit indicates whether the ballast belongs to a particular group.

SCENE 0-15

Each DALI ballast can store lamp power values for 16 different scenes. There is a value of the lamp power for every scene. If the command for calling up a scene (FB_DALIV2GoToScene()) is sent to one device, a group, or to all the devices (broadcast), then each of the affected lamps is set to the saved value. The output is limited by the values of MAX LEVEL, MIN LEVEL and PHYSICAL MIN LEVEL.

STATUS INFORMATION

The status information contains the most important items describing the status of a ballast. The 8-bit value can be read with the FB_DALIV2QueryStatus() block. The significance of the individual bits is defined as follows:

Bit | Description
0 | Status of the ballast. 0: OK.
1 | Lamp failure. 0: OK.
2 | Lamp power on. 0: OFF.
3 | Limit value error. 0: the most recently requested lamp power was either between MIN LEVEL and MAX LEVEL or was OFF.
4 | Fading completed: 0: fading finished. 1: fading active.
5 | Reset status. 0: No.
6 | Missing short address. 0: No.
7 | Power supply fault. 0: No, A reset or a lamp power control command has been received since the most recent power up.

VERSION NUMBER

The version number corresponds to the version number of the IEC standard in accordance with which the ballast was developed and manufactured. The version number can only be read, and is specified by the manufacturer of the ballasts. The major version (nMajorVersion) and the minor version (nMinorVersion) can each have a value in the range from 0 to 15 (4 bits).

DEVICE TYPE

The value can be read, for which the FB_DALIV2QueryDeviceType() block is used. The following device types are defined according to the IEC 62386 standard:

Value | Description
0 | Standard device
1 | Device for emergency lighting.
2 | Device for discharge lamps.
3 | Device for low-voltage halogen lamps.
4 | Device for dimming bulbs.
5 | Device for converting digital signals into DC signals.
6 | Device for light emitting diodes (LEDs).
7 | Switching function.
8 | Device for colour/colour temperature control.

PHYSICAL MIN LEVEL

The lowest physically possible lamp power level is stored by the manufacturer in the PHYSICAL MIN LEVEL variable. The value can only be read, for which the FB_DALIV2QueryPhysicalMinimumLevel() block is used.


Base - Function Blocks

Name | Description
FB_DALIV2Communication | Reads the DALI commands from the buffers sequentially and relays them to the KL6811.
FB_DALIV2SendDALICommand | This function-block sends a single DALI-command defined by the command-number and, if applicable, by a parameter-value.


FB_DALIV2Communication

The blocks for the DALI commands do not access the process image of the KL6811 directly, but place the individual DALI commands in three different buffers. The FB_DALIV2Communication() block sequentially reads the DALI commands from these three buffers and passes the DALI commands to the KL6811. This prevents multiple blocks accessing the KL6811 process image at the same time. Each of these three buffers is processed with a different priority (high, medium or low). The user of the PLC library can use the eCommandPriority parameter (available in most blocks) to determine the priority which with the FB_DALIV2Communication() block processes the respective DALI command.

All buffers in which the DALI commands are stored are associated with a variable of type ST_DALIV2CommandBuffer. There is one instance of the FB_DALIV2Communication() block and a variable of type ST_DALIV2CommandBuffer for each KL6811. If possible, the FB_DALIV2Communication() block should be called in a separate, faster task.

The buffer utilisation can be determined via the block outputs based on three arrays in which each element (0, 1 or 2) represents one of the three buffers (high, medium or low). If you detect regular overflow for one of the three buffers, you should consider the following:

- How heavily are the individual PLC tasks utilised? The TwinCAT System Manager offers various analysis tools.

- Try reducing the cycle time of the task in which the FB_DALIV2Communication() block is called. The value should not exceed 6 ms. Ideally it should be 2 ms.

- Check the cycle time of the PLC task in which the blocks for the individual DALI commands are called. This value should be between 10 ms and 60 ms.

- If possible avoid polling (regular reading) of values. Only read values when they are actually required.

- Distribute the individual ballasts evenly over several DALI lines. Overall data throughput is increased by the fact that several DALI lines are processed simultaneously during each PLC cycle.

VAR_INPUT

bResetMaximumDemandCounter    : BOOL;
bResetOverflowCounter         : BOOL;

bResetMaximumDemandCounter: A rising edge at this input resets the value of the maximum command-buffer-load, arrBufferMaximumDemandMeter (0 - 100%, see VAR_OUTPUT).

bResetOverflowCounter: A rising edge at this input resets the value of the total buffer-overflow-counter, arrBufferOverflowCounter (see VAR_OUTPUT).

VAR_OUTPUT

arrBufferDemandMeter          : ARRAY [0..2] OF BYTE;
arrBufferMaximumDemandMeter   : ARRAY [0..2] OF BYTE;
arrBufferOverflowCounter      : ARRAY [0..2] OF UINT;
bLineIsBusy                   : BOOL;
bLineIsInitialized            : BOOL;

arrBufferDemandMeter: Buffer utilisation (0 – 100%).

arrBufferMaximumDemandMeter: Previous maximum utilisation of the respective buffer (0 – 100%).

arrBufferOverflowCounter: Previous number of buffer overflows.

bLineIsBusy: This output is set as long as the FB_DALIV2Communication() block is active.

bLineIsInitialized: If the block is being called for the first time (e.g. when the controller is starting up) an initialisation process is executed. No DALI commands can be processed during this time.

VAR_IN_OUT

stDALIInData     : ST_DALIV2InData;
stDALIOutData    : ST_DALIV2OutData;
stCommandBuffer  : ST_DALIV2CommandBuffer;

stDALIInData: Structure in the input process image of the KL6811. It is used for communication from the KL6811 to the PLC.

stDALIOutData: Structure in the output process image of the KL6811. It is used for communication from the PLC to the KL6811.

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SendDALICommand

This function-block sends a single DALI-command defined by the command-number and, if applicable, by a parameter-value. Moreover it is possible it is possible to decide, if the command is to be sent twice and whether the function-block has to wait for an answer. The last mentioned option is very useful to send fast sequences of commands which do not require an answer from the device, such as the step-up-command.

VAR_INPUT

bStart                       : BOOL;
nAddr                        : BYTE;
eAddrType                    : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority             : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nCommand                     : INT;
nParameter                   : BYTE;
bWaitingForDALISlaveResponse : BOOL;
bRepeatCommand               : BOOL;
bSuppressResponseBuffer      : BOOL;
nDeviceType                  : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nCommand: The number of the DALI-command.

nParameter: Parameter to hand over command-specific values, eg. go to scene xxx.

bWaitingForDALISlaveResponse: If this input is set to FALSE, the function-block will not wait for an answer of the DALI-device. This feature doesn´t make any sense in combination with query-commands, of course.

bRepeatCommand: The command will be repeatet, if this input is set to TRUE.

bSuppressResponseBuffer: If set to TRUE, the answer of the function block FB_DALIV2Communication() will not be put into the internal software-buffer.

nDeviceType: Identifier for the device type.

Value | Description
0 | Standard device
1 | Device for emergency lighting.
2 | Device for discharge lamps.
3 | Device for low-voltage halogen lamps.
4 | Device for dimming bulbs.
5 | Device for converting digital signals into DC signals.
6 | Device for light emitting diodes (LEDs).
7 | Switching function.
8 | Device for colour/colour temperature control.

VAR_OUTPUT

bBusy                 : BOOL;
bError                : BOOL;
nErrorId              : UDINT;
nResponseData         : BYTE;

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.

nResponseData: The received value of the DALI ballast, if a query command is invoked.

VAR_IN_OUT

stCommandBuffer      : ST_DALIV2CommandBuffer;


Power Control - Function Blocks

Name | Description
FB_DALIV2DirectArcPowerControl | Directly specify the lamp power.
FB_DALIV2Down | Reduce lamp power.
FB_DALIV2EnableDAPCSequence | Marks the start of a Direct Arc Power Control (DAPC) Sequence.
FB_DALIV2GoToScene | Call up a scene.
FB_DALIV2Off | Switch the lamp off.
FB_DALIV2OnAndStepUp | Switch the lamp on if necessary, and increase the lamp power by one step.
FB_DALIV2RecallMaxLevel | Set the lamp power to MAX LEVEL.
FB_DALIV2RecallMinLevel | Set the lamp power to MIN LEVEL.
FB_DALIV2StepDown | Reduce the lamp power by one step.
FB_DALIV2StepDownAndOff | Reduce the lamp power by one step, and switch the lamp off if appropriate.
FB_DALIV2StepUp | Increase the lamp power by one step.
FB_DALIV2Up | Increase lamp power.


FB_DALIV2DirectArcPowerControl

If the nArcPowerLevel parameter is not within the range between MAX VALUE and MIN VALUE the lamp is switched to the corresponding minimum or maximum value. If the lamp is switched off this command will switch it on.
The speed with which the specified value should be reached is given by the FADE TIME variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nArcPowerLevel    : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nArcPowerLevel: Lamp power level.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Down

The lamp is made dimmer over a period of 200 ms. If the lamp power has already reached the MIN LEVEL value the brightness is not changed. This command does not switch the lamp off.
The rate at which dimming takes place during these 200 ms is given by the FADE RATE variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2EnableDAPCSequence

This command starts a Direct Arc Power Control (DAPC) sequence. Following this command, DirectArcPowerControl commands must be sent using the FB_DALIV2DirectArcPowerControl() function block. There must not be more than 200ms between the individual commands, or the sequence will be ended.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2GoToScene

This block sets the value of the lamp power that has been saved for the scene nScene. If the ballast does not belong to the scene, the value of the lamp's power is not changed. If the lamp is switched off this command will switch it on.
The speed with which the lamp power should be reached is given by the FADE TIME variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nScene            : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nScene: The scene that is to be activated (0 - 15).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Off

The DALI lamps are switched off immediately.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2OnAndStepUp

This block immediately sets the current lamp power value one step higher. If the lamp is switched off then it is switched on and set to MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2RecallMaxLevel

This block sets the current lamp power smoothly to a MAX LEVEL. If the lamp is switched off this command will switch it on.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2RecallMinLevel

This block sets the current lamp power smoothly to a MIN LEVEL. If the lamp is switched off this command will switch it on.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StepDown

This block immediately sets the current lamp power value one step lower. The lamp is not switched off by this command. The power is not further reduced if the lamp power has already reached MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StepDownAndOff

This block immediately sets the current lamp power value one step lower. The lamp is switched off if the power value has already reached MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StepUp

This block immediately sets the current lamp power value one step higher. The lamp is not switched on by this command. The power is not further increased if the lamp power has already reached MAX LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Up

The lamp is made brighter over a period of 200 ms. If the lamp power has already reached the MAX LEVEL value the brightness is not changed. This command does not switch the lamp on.
The rate at which dimming takes place during these 200 ms is given by the FADE RATE variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Configuration - Function Blocks

Name | Description
FB_DALIV2AddToGroup | Inserts one or more ballasts into a group.
FB_DALIV2EnableWriteMemory | Enables write access via FB_DALIV2WriteMemoryLocation() to the internal memory of the ballast.
FB_DALIV2RemoveFromGroup | Remove one or more ballasts from a group.
FB_DALIV2RemoveFromScene | Removes the ballast from the scene.
FB_DALIV2Reset | All variables are reset to their standard values.
FB_DALIV2StoreActualLevelInDTR | Writes the current value of the lamp power into the DTR.
FB_DALIV2StoreDTRAsFadeRate | Writes the value in the DTR into the FADE RATE variable.
FB_DALIV2StoreDTRAsFadeTime | Writes the value in the DTR into the FADE TIME variable.
FB_DALIV2StoreDTRAsMaxLevel | Writes the value in the DTR into the MAX LEVEL variable.
FB_DALIV2StoreDTRAsMinLevel | Writes the value in the DTR into the MIN LEVEL variable.
FB_DALIV2StoreDTRAsPowerOnLevel | Writes the value in the DTR into the POWER ON LEVEL variable.
FB_DALIV2StoreDTRAsScene | Saves the contents of the DTR as the lamp power value for a scene.
FB_DALIV2StoreDTRAsShortAddress | Saves the contents of the DTR as a short address, or deletes the short address.
FB_DALIV2StoreDTRAsSystemFailureLevel | Writes the value in the DTR into the SYSTEM FAILURE LEVEL variable.


FB_DALIV2AddToGroup

The ballasts addressed are inserted into the corresponding group (nGroup). A valid group number lies in the range between 0 and 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nGroup            : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nGroup: Group number (0 - 15).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2EnableWriteMemory

Enables write access via FB_DALIV2WriteMemoryLocation() to the internal memory of the ballast.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2RemoveFromGroup

One or more ballasts are removed from a group. A valid group number lies in the range between 0 and 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nGroup            : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nGroup : The group from which the ballast is to be removed.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2RemoveFromScene

One or more ballasts are removed from a scene. A valid scene number lies in the range between 0 and 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nScene            : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nScene: The scene from which the ballast is to be removed.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Reset

All the ballast's variables are reset to their standard values with this block.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreActualLevelInDTR

The block writes the current value of the lamp power into the DTR. This does not change the current value of the lamp power.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsFadeRate

Writes the value in the DTR into the FADE RATE variable. The range of possible values extends from 1 to 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsFadeTime

The block writes the value of the DTR into the FADE TIME variable. The range of possible values extends from 1 to 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsMaxLevel

This block writes the value of the DTR into the MAX LEVEL variable. If the value provided is smaller than MIN LEVEL then the value is simply set to MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsMinLevel

This block writes the value of the DTR into the MIN LEVEL variable (the minimum permitted lamp power). If the value provided is larger than MAX LEVEL then the value is simply set to MAX LEVEL. If the value provided is smaller than the PHYSICAL MIN LEVEL then MIN LEVEL will be set to PHYSICAL MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsPowerOnLevel

This block writes the value of the DTR into the POWER ON LEVEL variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsScene

The content of the DTR is saved as the value of the lamp power for the given scene. The range of values for the scene number extends from 0 to 15.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
nScene            : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

nScene: The scene for which the value of the lamp power should be changed.

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsShortAddress

The content of the DTR (Data Transfer Register) is saved as the short address at the corresponding ballast. The structure of the DTR is 0AAA AAA1 (A: significant address bit) or 1111 1111 (mask). If the DTR contains 1111 1111 the short address is deleted from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsSystemFailureLevel

This block writes the value of the DTR into the SYSTEM FAILURE LEVEL variable.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Queries - Function Blocks

Name | Description
FB_DALIV2QueryActualLevel | Read the ACTUAL DIM LEVEL variable (current lamp power).
FB_DALIV2QueryBallast | Query whether the ballast is ready to operate.
FB_DALIV2QueryContentDTR | Read out the DTR (Data Transfer Register).
FB_DALIV2QueryContentDTR1 | Read out the DTR1 (Data Transfer Register 1).
FB_DALIV2QueryContentDTR2 | Read out the DTR2 (Data Transfer Register 2).
FB_DALIV2QueryDeviceType | Query the device type.
FB_DALIV2QueryFadeTimeFadeRate | Read out the variables FADE RATE and FADE TIME.
FB_DALIV2QueryGroups | Query the group association.
FB_DALIV2QueryGroups0UpTo7 | Query the group association (groups 0 to 7).
FB_DALIV2QueryGroups8UpTo15 | Query the group association (groups 8 to 15).
FB_DALIV2QueryLampFailure | Query whether a lamp has failed.
FB_DALIV2QueryLampPowerOn | Query as to whether the lamp is switched on.
FB_DALIV2QueryLimitError | Query whether the last lamp power value could be used or not.
FB_DALIV2QueryMaxLevel | Read the MAX LEVEL variable (maximum permitted lamp power).
FB_DALIV2QueryMinLevel | Read the MIN LEVEL variable (minimum permitted lamp power).
FB_DALIV2QueryMissingShortAddress | Query as to whether the ballast does not have a short address.
FB_DALIV2QueryPhysicalMinLevel | Read the PHYSICAL MIN LEVEL variable (lowest lamp power that is physically possible).
FB_DALIV2QueryPowerFailure | Query whether the ballast has received a reset or a control command since it was switched on or not.
FB_DALIV2QueryPowerOnLevel | Read the POWER ON LEVEL variable (initial lamp power when switched on).
FB_DALIV2QueryRandomAddress | Read the RANDOM ADDRESS variable (direct address/long address).
FB_DALIV2QueryRandomAddressH | Read the high byte of the variable RANDOM ADDRESS (direct address/long address).
FB_DALIV2QueryRandomAddressL | Read the low byte of the variable RANDOM ADDRESS (direct address/long address).
FB_DALIV2QueryRandomAddressM | Read the middle byte of the variable RANDOM ADDRESS (direct address/long address).
FB_DALIV2QueryResetState | Query whether the ballast is in the reset state.
FB_DALIV2QuerySceneLevel | Query the lamp power value of a scene.
FB_DALIV2QueryStatus | Read the STATUS INFORMATION variable.
FB_DALIV2QuerySystemFailureLevel | Read the SYSTEM FAILURE LEVEL variable (the power value for the lamp in the presence of a system error).
FB_DALIV2QueryVersionNumber | Read the VERSION NUMBER variable.
FB_DALIV2ReadMemoryLocation | Read an 8-bit value from the ballast memory.


FB_DALIV2QueryActualLevel

The ACTUAL DIM LEVEL variable (current lamp power) is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nActualLevel      : BYTE;

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.

nActualLevel: Lamp power.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryBallast

The block provides information as to whether a specific ballast is ready for operation.

Using this command, it can easily be determined whether or not any ballasts at all are connected to a DALI line. To do this, the block with the parameter eAddrType = eDALIV2AddrTypeBroadcast is called. If the output bBallast is FALSE and output nError is 0, there is no ballast connected to the DALI line. If the output nError is 0 and the output bBallast is TRUE, there is exactly one ballast connected to the DALI line. If several ballasts are connected, nError will return 5 (several ballasts have replied). In this case it is irrelevant whether or not the ballasts have short addresses.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
bBallast          : BOOL;

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.

bBallast: If the output is active, the corresponding ballast is ready for operation.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryContentDTR

The contents of the DTR (Data Transfer Register) is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nContentDTR      : BYTE;

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.

nContentDTR : Contents of the DTR (Data Transfer Register).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryContentDTR1

The contents of the DTR1 (Data Transfer Register 1) is read from the DALI ballast.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nContentDTR1     : BYTE;

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. It is reset to 0 by the execution of an instruction at the inputs. See Error codes.

nContentDTR1: Contents of DTR1 (Data Transfer Register 1).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryContentDTR2

The contents of the DTR2 (Data Transfer Register 2) is read from the DALI ballast.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nContentDTR2     : BYTE;

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. It is reset to 0 by the execution of an instruction at the inputs. See Error codes.

nContentDTR2: Contents of DTR2 (Data Transfer Register 2).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryDeviceType

The device type (DEVICE TYPE) is read from the ballast. The following device types are defined according to the IEC 62386 standard:

Value | Description
0 | Standard device
1 | Device for emergency lighting.
2 | Device for discharge lamps.
3 | Device for low-voltage halogen lamps.
4 | Device for dimming bulbs.
5 | Device for converting digital signals into DC signals.
6 | Device for light emitting diodes (LEDs).
7 | Switching function.
8 | Device for colour/colour temperature control.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nDeviceType      : BYTE;

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.

nDeviceType: Identifier for the device type (see table above).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryFadeTimeFadeRate

The FADE TIME and FADE RATE variables are read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;
nFadeTime      : BYTE;
nFadeRate      : BYTE;

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.

nFadeTime: Fade time (0 to 15).

nFadeRate: Fade rate (1 to 15).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryGroups

The GROUP 0-7 and GROUP 8-15 variables are read from the ballast and combined into a 16 bit value. Each bit represents one group. Bit 0 represents group 0, while bit 15 represents group 15. If the bit is set, the ballast belongs to the corresponding group.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;
nGroups        : WORD;

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.

nGroups: Association with a group.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryGroups0UpTo7

The GROUP 0-7 variable is read from the ballast and linked to an 8 bit value. Each bit represents one group. Bit 0 represents group 0, while bit 7 represents group 7. If the bit is set, the ballast belongs to the corresponding group.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nGroups0UpTo7    : BYTE;

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.

nGroups0UpTo7: Association with a group.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryGroups8UpTo15

The GROUP 8-15 variable is read from the ballast and linked to an 8 bit value. Each bit represents one group. Bit 8 represents group 0, while bit 7 represents group 15. If the bit is set, the ballast belongs to the corresponding group.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nGroups8UpTo15   : BYTE;

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.

nGroups8UpTo15: Association with a group.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryLampFailure

The block provides information as to whether a specific ballast has a lamp problem.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
bLampFailure     : BOOL;

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.

bLampFailure: If the output is active there has been a lamp failure at the corresponding ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryLampPowerOn

The block returns the information as to whether the lamp associated with a specific ballast is switched on.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
bLampPowerOn     : BOOL;

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.

bLampPowerOn: If the output is active the lamp at the corresponding ballast is switched on.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryLimitError

The block indicates whether the most recent lamp power value at a specific ballast cannot be used on the grounds that it is either above MAX LEVEL or is below MIN LEVEL.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;
bLimitError    : BOOL;

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.

bLimitError: If the output is active, the most recent lamp power value cannot be used.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryMaxLevel

The MAX LEVEL variable (maximum permitted lamp power) is read from the ballast. This value specifies the upper limit for lamp power commands.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy        : BOOL;
bError       : BOOL;
nErrorId     : UDINT;
nMaxLevel    : BYTE;

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.

nMaxLevel: maximum permitted lamp power (0 - 254).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryMinLevel

The MIN LEVEL variable (minimum permitted lamp power) is read from the ballast. This value specifies the lower limit for lamp power commands.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy        : BOOL;
bError       : BOOL;
nErrorId     : UDINT;
nMinLevel    : BYTE;

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.

nMinLevel: minimum permitted lamp power (0 - 254).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryMissingShortAddress

The block provides information as to whether a specific ballast has a short address or not.

Using this command, it can be determined whether or not any ballasts without a short address are connected to a DALI line. To do this, the block with the parameter eAddrType = eDALIV2AddrTypeBroadcast is called. If output bMissingShortAddress is FALSE and output nError is 0, all ballasts have a valid short address. If the output nError is 0 and the output bMissingShortAddress is TRUE, there is exactly one ballast that has no short address. If several ballasts have no short address, nError will return 5 (several ballasts have replied).

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                : BOOL;
bError               : BOOL;
nErrorId             : UDINT;
bMissingShortAddress : BOOL;

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.

bMissingShortAddress: If the output is active the corresponding ballast does not have a short address.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryPhysicalMinLevel

The PHYSICAL MIN LEVEL variable (minimum physically possible lamp power) is read from the ballast. This value can only be read, and is specified by the manufacturer.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nPhysicalMinLevel : BYTE;

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.

nPhysicalMinLevel: the lowest physically possible lamp power (0 - 254).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryPowerFailure

Query whether the ballast has received a reset or a control command since it was switched on or not.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy         : BOOL;
bError        : BOOL;
nErrorId      : UDINT;
bPowerFailure : BOOL;

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.

bPowerFailure: If the output is active, no lamp power control command has yet been sent to the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryPowerOnLevel

The POWER ON LEVEL variable (initial lamp power) is read from the ballast. The lamp switches itself to this power value immediately after the power is connected to the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
nErrorId        : UDINT;
nPowerOnLevel   : BYTE;

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.

nPowerOnLevel: Lamp power at switch-on (0 - 254).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryRandomAddress

The RANDOM ADDRESS variable is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nRandomAddress   : UDINT;

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.

nRandomAddress: Random address/long address of the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryRandomAddressH

The high-order byte of the RANDOM ADDRESS variable is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nRandomAddressH   : BYTE;

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.

nRandomAddressH: The high-order byte of the random address/long address.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryRandomAddressL

The low-order byte of the RANDOM ADDRESS variable is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nRandomAddressL   : BYTE;

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.

nRandomAddressL: The low-order byte of the random address/long address.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryRandomAddressM

The medium-order byte of the RANDOM ADDRESS variable is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nRandomAddressM   : BYTE;

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.

nRandomAddressM: The medium-order byte of the random address/long address.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryResetState

The block provides information as to whether a specific ballast is in the reset state.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy       : BOOL;
bError      : BOOL;
nErrorId    : UDINT;
bResetState : BOOL;

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.

bResetState: If the output is active the corresponding ballast is in the reset state.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QuerySceneLevel

The lamp power value of the corresponding scene is read from the ballast.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nScene            : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nScene: Scene from which the lamp power value is to be read (0 - 15).

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;
nSceneLevel    : BYTE;

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.

nSceneLevel: The lamp power value associated with scene.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryStatus

The STATUS INFORMATION variable is read by the ballast. The status information contains the eight most important items describing the status of a ballast. The significance of the individual bits is defined as follows:

Bit | Description
0 | Status of the ballast. 0: OK.
1 | Lamp failure. 0: OK.
2 | Lamp power on. 0: OFF.
3 | Limit value error. 0: the most recently requested lamp power was either between MIN LEVEL and MAX LEVEL or was OFF.
4 | Fading completed: 0: fading finished. 1: fading active.
5 | Reset status. 0: No.
6 | Missing short address. 0: No.
7 | Power supply fault. 0: No, A reset or a lamp power control command has been received since the most recent power up.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy       : BOOL;
bError      : BOOL;
nErrorId    : UDINT;
nStatus     : BYTE;

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.

nStatus: Status information (see table above).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QuerySystemFailureLevel

The SYSTEM FAILURE LEVEL variable is read from the ballast. If a fault (such as the absence of the supply voltage) is detected on the DALI bus, the ballast switches the lamp to this power value.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy               : BOOL;
bError              : BOOL;
nErrorId            : UDINT;
nSystemFailureLevel : BYTE;

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.

nSystemFailureLevel : The value of lamp power to be adopted in the event of a system fault.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryVersionNumber

The VERSION NUMBER variable is read from the ballast. The version number corresponds to the version number of the IEC standard in accordance with which the software and hardware of the ballast has been developed and manufactured. The version number can only be read, and is specified by the manufacturer. The major version (nMajorVersion) and the minor version (nMinorVersion) can each have a value in the range from 0 to 15 (4 bits).

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nMajorVersion    : BYTE;
nMinorVersion    : BYTE;

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.

nMajorVersion: Main version number.

nMinorVersion: Minor version number.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ReadMemoryLocation

One byte is read from the DALI ballast memory. The exact memory bank is specified by the DTR1 and the address within the memory bank by the DTR.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy     : BOOL;
bError    : BOOL;
nErrorId  : UDINT;
nData     : BYTE;

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.

nData: Byte read from the ballast memory.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


Special Commands - Function Blocks

Name | Description
FB_DALIV2Compare | The ballast compares its RANDOM ADDRESS with the SEARCH ADDRESS.
FB_DALIV2EnableDeviceType | Switching to application-related expansion command.
FB_DALIV2Initialise | Starts the addressing of the ballasts.
FB_DALIV2PhysicalSelection | Any ballast that receives this command enters the physical selection mode.
FB_DALIV2ProgramShortAddress | All the selected ballasts save the nShortAddress (SHORT ADDRESS) value as their short address.
FB_DALIV2QueryShortAddress | If the RANDOM ADDRESS is the same as the SEARCH ADDRESS then the ballast sends its short address.
FB_DALIV2Randomise | The ballasts generate a new RANDOM ADDRESS.
FB_DALIV2SearchAddr | This block sets the SEARCH ADDRESS.
FB_DALIV2SearchAddrH | This block sets the upper 8 bits of the 24-bit SEARCH ADDRESS.
FB_DALIV2SearchAddrL | This block sets the lower 8 bits of the 24-bit SEARCH ADDRESS.
FB_DALIV2SearchAddrM | This block sets the middle 8 bits of the 24-bit SEARCH ADDRESS.
FB_DALIV2SetDTR | Writes an 8 bit value into the DTR of all the ballasts.
FB_DALIV2SetDTR1 | Writes an 8 bit value into the DTR1 of all the ballasts.
FB_DALIV2SetDTR2 | Writes an 8 bit value into the DTR2 of all the ballasts.
FB_DALIV2Terminate | The addressing of all the ballasts is halted.
FB_DALIV2VerifyShortAddress | If the short address in the ballast is equal to the nShortAddress parameter, TRUE is asserted at the bAnswer output.
FB_DALIV2Withdraw | Ballasts in which the RANDOM ADDRESS is the same as the SEARCH ADDRESS must no longer react to the FB_DALIV2Compare() command.
FB_DALIV2WriteMemoryLocation | Writes an 8 bit value into the memory of a ballast. Access to the memory must first be enabled with the FB_DALIV2EnableWriteMemory() command.


FB_DALIV2Compare

The ballast compares its RANDOM ADDRESS with the SEARCH ADDRESS. If the random address is smaller than or equal to the search address, and if the ballast is not connected, then the output bAnswer is set to TRUE.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
bAnswer           : BOOL;

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.

bAnswer: The random address is smaller than or equal to the search address.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2EnableDeviceType

This command must be sent every time prior to an application-specific extension command. Only the ballasts that belong to the corresponding device type (DEVICE TYPE) react to this. The command does not have to be used for device type 0. The following device types are defined according to the IEC 62386 standard:

Value | Description
0 | Standard device.
1 | Device for emergency lighting.
2 | Device for discharge lamps.
3 | Device for low-voltage halogen lamps.
4 | Device for dimming bulbs.
5 | Device for converting digital signals into DC signals.
6 | Device for light emitting diodes (LEDs).
7 | Switching function.
8 | Device for colour/colour temperature control.

VAR_INPUT

bStart             : BOOL;
eCommandPriority   : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDeviceType        : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDeviceType: Identifier for the device type (see table above).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Initialise

The addressing of the ballasts is started with this command. The addressing has to be halted again with the FB_DALIV2Terminate() block. The maximum duration is limited to 15 minutes. Each ballast ends the addressing automatically after 15 minutes had elapsed. The reaction of the ballasts that receive this command depends on the parameter nParameter:

Value (binary) | Description
0000 0000 | All ballasts react.
0AAA AAA1 | Ballasts with the address AAA AAA react.
1111 1111 | Ballasts with no short address react.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nParameter        : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nParameter: Specifies which ballasts should react to this command (see table above).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2PhysicalSelection

Any ballast that receives this command enters the physical selection mode. In this mode, the comparison of the RANDOM ADDRESS with the SEARCH ADDRESS is blocked.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ProgramShortAddress

All the selected ballasts save the nShortAddress (SHORT ADDRESS) value as their short address.

Selected means:

  • The RANDOM ADDRESS of the ballast is the same as the SEARCH ADDRESS.
  • Physical selection is determined by the ballast, as the lamp has been disconnected from the ballast (after receiving the FB_DALIV2PhysicalSelection() command).

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nShortAddress     : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nShortAddress: Short address to be assigned to the selected ballasts (0 - 63).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryShortAddress

Once the ballast has been selected, it sends its short address (SHORT ADDRESS).

Selected means:

  • The RANDOM ADDRESS of the ballast is the same as the SEARCH ADDRESS.
  • Physical selection is determined by the ballast, as the lamp has been disconnected from the ballast (after receiving the FB_DALIV2PhysicalSelection() command).

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nShortAddress    : BYTE;

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.

nShortAddress: Short address of the ballast (0 - 63).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Randomise

The ballasts generate a new RANDOM ADDRESS.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SearchAddr

This block sets a SEARCH ADDRESS.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nSearchAddr       : UDINT;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nSearchAddr: Search address.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SearchAddrH

This block sets the upper 8 bits of the 24-bit SEARCH ADDRESS.

VAR_INPUT

bStart              : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nHighByteSearchAddr : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nHighByteSearchAddr: upper 8 bits of the 24-bit search address.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SearchAddrL

This block sets the lower 8 bits of the 24-bit SEARCH ADDRESS.

VAR_INPUT

bStart             : BOOL;
eCommandPriority   : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nLowByteSearchAddr : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nLowByteSearchAddr: lower 8 bits of the 24-bit search address.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SearchAddrM

This block sets the middle 8 bits of the 24-bit SEARCH ADDRESS.

VAR_INPUT

bStart             : BOOL;
eCommandPriority   : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nMidByteSearchAddr : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nMidByteSearchAddr: middle 8 bits of the 24-bit search address.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SetDTR

This command is only available as a broadcast. Data is written to the DTR of all the ballasts.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDTR              : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDTR: The value that is to be written into the DTR.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SetDTR1

Data is written to the DTR1 of all the ballasts. This command is only available as a broadcast.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDTR1             : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDTR1: The value that is to be written into the DTR1.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SetDTR2

Data is written to the DTR2 of all the ballasts. This command is only available as a broadcast.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDTR2             : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDTR2: The value that is to be written into the DTR2.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Terminate

The addressing of all the ballasts is halted.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2VerifyShortAddress

If the short address in the ballast is equal to the nShortAddress parameter, TRUE is asserted at the bAnswer output.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nShortAddress     : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nShortAddress: Short address with which the ballast's short address is to be compared.

VAR_OUTPUT

bBusy         : BOOL;
bError        : BOOL;
nErrorId      : UDINT;
bAnswer       : BOOL;

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.

bAnswer: The nShortAddress parameter is the same as the ballast's own address.

VAR_IN_OUT

stCommandBuffer     : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Withdraw

Ballasts in which the RANDOM ADDRESS is the same as the SEARCH ADDRESS must no longer react to the FB_DALIV2Compare() command.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2WriteMemoryLocation

This command is only available as a broadcast. The value nData is written into the memory of the ballast. The memory bank is selected by the content of the DTR1 and the address is given by the content of the DTR. Call the command FB_DALIV2EnableWriteMemory() is required to enable write access to the memory.

Note: This command will only be executed by DALI-devices, which correspond with IEC 62386.

VAR_INPUT

bStart            : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nData             : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nData: The value that is to be written into the Memory of the ballast.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DSIDirectArcPowerControl

The parameter nArcPowerLevel specifies the brightness, the lamp is switched to.

nArcPowerLevel | Comment
0 | lamp is switched off
1 | lamp is switched to minimum brightness
255 | lamp is switched to maximum brightness

Ballasts with DSI interface have no short address. All ballasts connected to a DSI line will get the same value.

Pleas pay attention, that the KL6811 has to be switched to DSI mode. Details may be found in the KL6811 manual.

DSI ballasts and DALI ballasts can not be nixed in the same line. But it is possible to operate several KL6811 with different operation modes (DSI/DALI) at the same controller.

VAR_INPUT

bStart           : BOOL;
eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nArcPowerLevel   : BYTE;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nArcPowerLevel: Lamp power level (0 ... 255).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Settings - Function Blocks

Name | Description
FB_DALIV2GetSettings | Function block for reading all device data from all ballasts on one DALI line.
FB_DALIV2GetSettingsSingleDevice | Function block for reading all device data from one ballast on one DALI line.
FB_DALIV2SetSettings | Function block for setting all device data of all ballasts on one DALI line.


FB_DALIV2GetSettings

This block reads the variables (MIN LEVEL, MAX LEVEL, FADE TIME, ...) of all ballasts within DALI line and saves them in a structure of type ST_DALIV2DeviceSettings.

Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. A check is first made as to whether a ballast is present at all. If this is the case, then the bPresent bit is set in the corresponding structure (see ST_DALIV2DeviceSettings), after which the settings of the ballast are read out one by one and written into the associated variables in the structure. If it is found that a device is not available, the reading is skipped and work continues with the next device. The structure index here reflects the address of the device. In other words, data for the device with short address 0 is located at arrDALIDeviceSettings[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettings[63]. If a read error occurs when reading from a device, the nErrors element is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the reading of a variable from a ballast.

Bit | Error
0 | An error occurred whilst attempting to seek the ballast.
1 | Error whilst reading the variable ACTUAL DIM LEVEL.
2 | Error whilst reading the variable POWER ON LEVEL.
3 | Error whilst reading the variable SYSTEM FAILURE LEVEL.
4 | Error whilst reading the variable MIN LEVEL.
5 | Error whilst reading the variable MAX LEVEL.
6 | Error whilst reading the variable FADE RATE.
7 | Error whilst reading the variable FADE TIME.
8 | Error whilst reading the variable RANDOM ADDRESS.
9 | Error whilst reading the variables GROUP 0-7 and GROUP 8-15.
10 | Error whilst reading the variables SCENE 0 to SCENE 15.
11 | Error whilst reading the variable STATUS INFORMATION.
12 | Error whilst reading the variable VERSION NUMBER.
13 | Error whilst reading the variable DEVICE TYPE.
14 | Error whilst reading the variable PHYSICAL MIN LEVEL.

When the function block has been processed, the bBusy output changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many ballasts are attached.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nOptions            : DWORD;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the reading of the variable.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nOptions: Options for reading the variables (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_ACTUAL_DIM_LEVEL | The variable ACTUAL DIM LEVEL is read.
DALIV2_OPTION_POWER_ON_LEVEL | The variable POWER ON LEVEL is read.
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL is read.
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL is read.
DALIV2_OPTION_MAX_LEVEL | The variable MAX LEVEL is read.
DALIV2_OPTION_FADE_RATE_FADE_TIME | The variables FADE RATE and FADE TIME are read.
DALIV2_OPTION_RANDOM_ADDRESS | The variable RANDOM ADDRESS is read.
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 are read.
DALIV2_OPTION_SCENE_LEVELS | The variables SCENE 0 to SCENE 15 are read.
DALIV2_OPTION_STATUS_INFORMATION | The variable STATUS INFORMATION is read.
DALIV2_OPTION_VERSION_NUMBER | The variable VERSION NUMBER is read.
DALIV2_OPTION_DEVICE_TYPE | The variable DEVICE TYPE is read.
DALIV2_OPTION_PHYSICAL_MIN_LEVEL | The variable PHYSICAL MIN LEVEL is read.
DALIV2_OPTION_DONT_CLEAR_DEVICE_SETTINGS | Before reading doesn't delete the variable arrDALIDeviceSettings.
DALIV2_OPTION_ALL | All variables are read.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nCurrentShortAddr : BYTE;

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.

nCurrentShortAddr: Short address of the ballast from which variables are being read.

VAR_IN_OUT

stCommandBuffer        : ST_DALIV2CommandBuffer;
arrDALIDeviceSettings  : ARRAY [0..63] OF ST_DALIV2DeviceSettings;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

arrDALIDeviceSettings: Reference to an array of 64 elements of type ST_DALIV2DeviceSettings. The settings of each individual DALI ballast are stored in these variables.


FB_DALIV2GetSettingsSingleDevice

This block reads the variables (MIN LEVEL, MAX LEVEL, FADE TIME, ...) of a single DALI-device and saves them in a structure of the type ST_DALIV2DeviceSettings.

With a positive edge at the input bStart the function-block begins its operation, reads all values one after another out of the addressed device and stores them into ST_DALIV2DeviceSettings. If an error occurs, the specific bit of the variable nErrors in the structure will be set. The following table gives an overview of all possible errors:

Bit | Error
0 | An error occurred whilst attempting to seek the ballast.
1 | Error whilst reading the variable ACTUAL DIM LEVEL.
2 | Error whilst reading the variable POWER ON LEVEL.
3 | Error whilst reading the variable SYSTEM FAILURE LEVEL.
4 | Error whilst reading the variable MIN LEVEL.
5 | Error whilst reading the variable MAX LEVEL.
6 | Error whilst reading the variable FADE RATE.
7 | Error whilst reading the variable FADE TIME.
8 | Error whilst reading the variable RANDOM ADDRESS.
9 | Error whilst reading the variables GROUP 0-7 and GROUP 8-15.
10 | Error whilst reading the variables SCENE 0 to SCENE 15.
11 | Error whilst reading the variable STATUS INFORMATION.
12 | Error whilst reading the variable VERSION NUMBER.
13 | Error whilst reading the variable DEVICE TYPE.
14 | Error whilst reading the variable PHYSICAL MIN LEVEL.

When the function block has been processed, the bBusy output changes from TRUE to FALSE.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nOptions            : DWORD;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the reading of the variable.

nAddr: The address of the device, which values shall be read.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nOptions: Options for reading the variables (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_ACTUAL_DIM_LEVEL | The variable ACTUAL DIM LEVEL is read.
DALIV2_OPTION_POWER_ON_LEVEL | The variable POWER ON LEVEL is read.
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL is read.
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL is read.
DALIV2_OPTION_MAX_LEVEL | The variable MAX LEVEL is read.
DALIV2_OPTION_FADE_RATE_FADE_TIME | The variables FADE RATE and FADE TIME are read.
DALIV2_OPTION_RANDOM_ADDRESS | The variable RANDOM ADDRESS is read.
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 are read.
DALIV2_OPTION_SCENE_LEVELS | The variables SCENE 0 to SCENE 15 are read.
DALIV2_OPTION_STATUS_INFORMATION | The variable STATUS INFORMATION is read.
DALIV2_OPTION_VERSION_NUMBER | The variable VERSION NUMBER is read.
DALIV2_OPTION_DEVICE_TYPE | The variable DEVICE TYPE is read.
DALIV2_OPTION_PHYSICAL_MIN_LEVEL | The variable PHYSICAL MIN LEVEL is read.
DALIV2_OPTION_DONT_CLEAR_DEVICE_SETTINGS | Before reading doesn't delete the variable stDALIDeviceSettings.
DALIV2_OPTION_ALL | All variables are read.

VAR_OUTPUT

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

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;
stDALIDeviceSettings   : ST_DALIV2DeviceSettings;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

stDALIDeviceSettings: A reference to the structure of type ST_DALIV2DeviceSettings. The settings of the DALI ballast are stored in these variable.


FB_DALIV2SetSettings

This block initialises the variables (MIN LEVEL, MAX LEVEL, FADE TIME ...) of all ballasts within a DALI line with the values stored in a structure of type ST_DALIV2DeviceSettings.

Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. The system first checks whether the bPresent bit is set in the respective structure (see ST_DALIV2DeviceSettings). If this is the case, all ballast variables that are not write-protected are initialised with the respective values of the structure. The structure index here reflects the address of the ballast. In other words, data for the device with short address 0 is located at arrDALIDeviceSettings[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettings[63]. If a write error occurs for a device, the nErrors element is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the writing of a variable to a ballast.

Bit | Error
2 | Error whilst writing the variable POWER ON LEVEL.
3 | Error whilst writing the variable SYSTEM FAILURE LEVEL.
4 | Error whilst writing the variable MIN LEVEL.
5 | Error whilst writing the variable MAX LEVEL.
6 | Error whilst writing the variable FADE RATE.
7 | Error whilst writing the variable FADE TIME.
9 | Error whilst writing the variables GROUP 0-7 and GROUP 8-15.
10 | Error whilst writing the variables SCENE 0 to SCENE 15.

When the function block has been processed, the bBusy output changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many ballasts are attached.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nOptions            : DWORD;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the initialisation of the variable.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nOptions: Options for writing the variables (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_POWER_ON_LEVEL | The variable POWER ON LEVEL is initialised.
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL is initialised.
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL is initialised.
DALIV2_OPTION_MAX_LEVEL | The variable MAX LEVEL is initialised.
DALIV2_OPTION_FADE_RATE | The variable FADE RATE is initialised.
DALIV2_OPTION_FADE_TIME | The variable FADE TIME is initialised.
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 are initialised.
DALIV2_OPTION_SCENE_LEVELS | The variables SCENE 0 to SCENE 15 are initialised.
DALIV2_OPTION_ALL | All variables are initialised.
DALIV2_OPTION_PUSH_DALI_COMMANDS | The buffer, which contains the feedback telegrams from the ballasts, among other things, is not read. Hence, writing becomes faster, but errors are not recognised.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nCurrentShortAddr : BYTE;

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.

nCurrentShortAddr: Short address of the ballast for which variables are being initialised.

VAR_IN_OUT

stCommandBuffer        : ST_DALIV2CommandBuffer;
arrDALIDeviceSettings  : ARRAY [0..63] OF ST_DALIV2DeviceSettings;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

arrDALIDeviceSettings: Reference to an array of 64 elements of type ST_DALIV2DeviceSettings. The settings of each individual DALI ballast are stored in these variables.


Addressing - Function Blocks

Name | Description
FB_DALIV2AddressingPhysicalSelection | Addresses the ballasts according to the ‘physical selection’ addressing method.
FB_DALIV2AddressingRandomAddressing | Addresses the ballasts according to the random principle.
FB_DALIV2AddressingIntRandomAddressing | Addresses the ballasts according to the random principle.. The KL6811’s internal addressing function is used here.
FB_DALIV2SetShortAddress | Ballasts receive a (new) short address.
FB_DALIV2SwapShortAddress | Swap the short addresses of two ballasts.
FB_DALIV2SwapShortAddressList | Swaps the short addresses of several ballasts.
FB_DALIV2ChangeAddressList | The short addresses of several ballasts can be changed using this function block.


FB_DALIV2AddressingIntRandomAddressing

This function block addresses the ballasts in random order. The user has no influence over which short address is assigned to which ballast. Short addresses are allocated in ascending order.

Applying a rising edge to the bStart input initiates the block, and the bBusy output goes TRUE. Depending on the selected options (parameter nOptions) the group associations and scenarios are subsequently deleted. The terminal now addresses all ballasts independently. Once all ballasts have been addressed, the bBusy output switches back to FALSE. The nAddressedDevices output variable supplies information about how many ballasts have received a short address. Processing this function block can take several minutes, depending on how many ballasts are attached. Since the addressing is performed directly by the terminal, this method is somewhat faster than the FB_DALIV2AddressingRandomAddressing() function block. However, this function block does not supply any feedback during addressing. In addition to that, addressing cannot be terminated prematurely.

This function block can only be executed if the terminal has the firmware version 2A or newer.

VAR_INPUT

bStart                   : BOOL;
nStartWithShortAddress   : BYTE;
nOptions                 : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;

bStart: A rising edge at this input activates the block, thereby starting the addressing sequence.

nStartWithShortAddress: Short address allocated to the first ballast (0 ... 63).

nOptions: Options for addressing the ballasts (see table). The individual constants must be linked with OR operators.

Constant | Description
DALIV2_OPTION_COMPLETE_NEW_INSTALLATION | All ballasts are re-addressed, including ballasts that already have a short address.
DALIV2_OPTION_DELETE_ALL_GROUP_ASSIGNMENTS | Prior to addressing, the group associations are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables GROUP 0-7 and GROUP 8-15).
DALIV2_OPTION_DELETE_ALL_SCENE_ASSIGNMENTS | Prior to addressing, the scenes are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables SCENE 0 to SCENE 15).
DALIV2_OPTION_OPTICAL_FEEDBACK | Prior to addressing, all ballasts are set to MIN LEVEL. Newly addressed ballasts are assigned MAX LEVEL brightness after allocation of the short address.

VAR_OUTPUT

bBusy                    : BOOL;
bError                   : BOOL;
nErrorId                 : UDINT;
nAddressedDevices        : BYTE;

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.

nAddressedDevices: If addressing has been completed (bBusy is FALSE), then the number of addressed ballasts is shown at this output.

VAR_IN_OUT

stCommandBuffer          : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2AddressingPhysicalSelection

This function block addresses the ballasts through 'physical selection' based on the addressing technique. This means that the individual ballasts are selected (and therefore addressed) by removing the lamps. Short addresses are allocated (ascending) in the same order in which the lamps are removed.

Applying a rising edge to the bStart input starts the block, and the bBusy output goes TRUE. Depending on the selected options (parameter nOptions) the group associations and scenarios are subsequently deleted. The eCurrentAddressingState output specifies the next required user operation. It determines whether for the next ballast the lamp should be removed or reinserted. The arrAddressedDevices output variable provides information about which ballasts have already been allocated a short address. Once all ballasts have been addressed, the addressing procedure is completed through a rising edge at input bStop, and the bBusy output switches back to FALSE.

VAR_INPUT

bStart                   : BOOL;
bStop                    : BOOL;
nStartWithShortAddress   : BYTE;
nOptions                 : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;

bStart: A rising edge at this input activates the block, thereby starting the addressing sequence.

bStop: A rising edge at this input deactivates the block, thereby stopping the addressing sequence.

nStartWithShortAddress: Short address allocated to the first ballast (0 ... 63).

nOptions: Options for addressing the ballasts (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_COMPLETE_NEW_INSTALLATION | All ballasts are re-addressed, including ballasts that already have a short address.
DALIV2_OPTION_DELETE_ALL_GROUP_ASSIGNMENTS | Prior to addressing, the group associations are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables GROUP 0-7 and GROUP 8-15).
DALIV2_OPTION_DELETE_ALL_SCENE_ASSIGNMENTS | Prior to addressing, the scenes are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables SCENE 0 to SCENE 15).
DALIV2_OPTION_WITHOUT_RANDOMISE | Prior to addressing, all ballasts are set to MIN LEVEL. Newly addressed ballasts are assigned MAX LEVEL brightness after allocation of the short address.

VAR_OUTPUT

bBusy                    : BOOL;
bError                   : BOOL;
nErrorId                 : UDINT;
arrAddressedDevices      : ARRAY [0..63] OF BOOL;
eCurrentAddressingState  : E_DALIV2CurrentAddressingState;

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.

arrAddressedDevices: Once a short address is assigned to a ballast, the associated element is set in the array. The array index reflects the short address of the ballast.

eCurrentAddressingState: The output variable indicates the current step (see table).

Element | Description
eDALIV2AddrStateIdle | No addressing takes place.
eDALIV2AddrStateRemoveLamp | The block waits for a lamp to be removed at a ballast.
eDALIV2AddrStateReinsertLamp | The block has detected the ballast on which the lamp was removed (the ballast is selected) and now waits for it to be inserted again.
eDALIV2AddrStateAddressingLamp | The selected ballast is addressed.

VAR_IN_OUT

stCommandBuffer          : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2AddressingRandomAddressing

This function block addresses the ballasts in random order. The user has no influence over which short address is assigned to which ballast. Short addresses are allocated in ascending order.

Applying a rising edge to the bStart input starts the block, and the bBusy output goes TRUE. Depending on the selected options (parameter nOptions) the group associations and scenarios are subsequently deleted. The block now addresses all ballasts independently. The arrAddressedDevices output variable provides information about which ballasts have already been allocated a short address. Once all ballasts have been addressed, the bBusy output switches back to FALSE. Addressing can be aborted through a rising edge at input bCancel. Processing this function block can take several minutes, depending on how many ballasts are attached.

VAR_INPUT

bStart                   : BOOL;
bCancel                  : BOOL;
nStartWithShortAddress   : BYTE;
nOptions                 : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;

bStart: A rising edge at this input activates the block, thereby starting the addressing sequence.

bCancel: A rising edge at this input deactivates the block, thereby interrupting the addressing sequence.

nStartWithShortAddress: Short address allocated to the first ballast (0 ... 63).

nOptions: Options for addressing the ballasts (see table). The individual constants must be linked with OR operators.

Constant | Description
DALIV2_OPTION_COMPLETE_NEW_INSTALLATION | All ballasts are re-addressed, including ballasts that already have a short address.
DALIV2_OPTION_DELETE_ALL_GROUP_ASSIGNMENTS | Prior to addressing, the group associations are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables GROUP 0-7 and GROUP 8-15).
DALIV2_OPTION_DELETE_ALL_SCENE_ASSIGNMENTS | Prior to addressing, the scenes are deleted for any ballasts, even those which may not be addressed by the addressing method (see variables SCENE 0 to SCENE 15).
DALIV2_OPTION_OPTICAL_FEEDBACK | Prior to addressing, all ballasts are set to MIN LEVEL. Newly addressed ballasts are assigned MAX LEVEL brightness after allocation of the short address.
DALIV2_OPTION_WITHOUT_RANDOMISE | The RANDOMISE command is not called before the addressing sequence. This means that all ballasts retain their existing random address (RANDOM ADDRESS). Only use this option when necessary.

VAR_OUTPUT

bBusy                    : BOOL;
bError                   : BOOL;
nErrorId                 : UDINT;
nCurrentSearchAddress    : UDINT;
arrAddressedDevices      : ARRAY [0..63] OF BOOL;

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.

nCurrentSearchAddress: Current search address (SEARCH ADDRESS).

arrAddressedDevices: Once a short address is assigned to a ballast, the associated element is set in the array. The array index reflects the short address of the ballast.

VAR_IN_OUT

stCommandBuffer          : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ChangeAddressList

The short addresses of several ballasts can be changed using this function block. As opposed to the FB_DALIV2SwapShortAddressList block, it is not necessary for a free, unused short address to be present in the DALI line.

A list of the ballasts whose short addresses are to be changed is transferred in the arrChangeAddressList array of type ST_DALIV2ChangeAddressList. The list has 64 entries from 0 to 63. Each entry contains a variable nOldAddress and nNewAddress with which the address assignment is parameterised. The list end is programmed with a 255 entry at nOldAddress, so that the whole list does not necessarily have to be filled in. If this entry is missing, however, then all entries are accepted. When the block is started (rising edge on bStart), the list end is first determined on the basis of the above-described entry and afterwards the valid list range is examined for the following false entries:

  • Address entries > 63
  • Double address entry on the original page nOldAddress (would not make sense)
  • Double address entry on the target page nNewAddress (leads to double assignment of an address and, hence, to errors)

The block then determines the internal long addresses of the DALI devices on the basis of the short addresses and enters them respectively to the parameters nRandomAddressHigh, nRandomAddressMiddle and nRandomAddressLow in the list. If an error occurs during this query, this leads to a false entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList). The further sequence in the block now depends on the option DALIV2_OPTION_SAFE_ADDRESSING (nOptions input). If it is set, then safe new addressing takes place: first of all, all short addresses of the selected DALI devices are deleted. Afterwards, status queries are sent to all desired new addresses in the DALI line. 2 cases are now possible:

  • If a device responds to this query, then this desired new address is already otherwise assigned. The previously “deleted” DALI devices are programmed with their old addresses and an error message is output.
  • If no devices respond to this status query, then the previously “deleted” DALI devices are programmed with the desired new addresses.

The reprogramming is checked afterwards in both cases. If an error occurs during deletion, during the status query or during the reprogramming, this leads to a false entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList).
If the option DALIV2_OPTION_SAFE_ADDRESSING (nOptions input) is not set, then the deletion of the short addresses and the status query for the presence of desired new addresses are omitted and the new addresses are programmed directly. This is possible because programming takes place via the long address determined beforehand. Reprogramming is not verified in this case.

The individual bits in the list element nErrors have the following meaning:

Bit | Error
0 | Error whilst reading the high byte of the long address (nRandomAddressHigh).
1 | Error whilst reading the middle byte of the long address (nRandomAddressMiddle).
2 | Error whilst reading the low byte of the long address (nRandomAddressLow).
3 | Error whilst deleting a short address.
4 | Error whilst verifying a short address.
5 | Error whilst programming a short address.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
nOptions            : DWORD := 0;

bStart: The block is activated by a rising edge at this input.

eCommandPriority: Priority (high, medium or low) with which the command is processed by the library.

nOptions: Options for writing the variables (see table). The individual constants must be linked with OR operators.

Constant | Description
DALIV2_OPTION_SAFE_ADDRESSING | Safe addressing: Old short addresses are deleted, the new ones are checked to see if they already exist and reprogramming is verified.

VAR_OUTPUT

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

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 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 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

arrChangeAddressList     : ARRAY [0.. 63] OF ST_DALIV2ChangeAddressList;
stCommandBuffer          : ST_DALIV2CommandBuffer;

arrChangeAddressList: A reference to the list containing the short addresses to be changed.


FB_DALIV2SetShortAddress

One or more ballasts receive a (new) short address with the aid of this block. Valid short addresses lie in the range between 0 and 63. If 255 is specified as the short address, the ballast's short address is deleted.
If you want to give a short address to a device that does not yet have one, you must transmit the command as a broadcast (eAddrType = eDALIV2AddrTypeBroadcast). This gives all the ballasts that are connected to the DALI terminal the short address nAddr. This includes the ballasts that did not so far have a short address.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nNewShortAddress  : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

nNewShortAddress: New short address (0-15) or mask (255).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SwapShortAddress

The short addresses of two ballasts can be swapped using this function block. In order to do this, however, it is necessary that a free, unused short address is present in the DALI line.

VAR_INPUT

bStart                   : BOOL;
nShortAddress01          : BYTE;
nShortAddress02          : BYTE;
nFreeShortAddress        : BYTE;

bStart: The block is activated by a rising edge at this input.

nShortAddress01: Short address of the first ballast (0 – 63).

nShortAddress02: Short address of the second ballast (0 – 63).

nFreeShortAddress: Free short address (0 – 63).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2SwapShortAddressList

The short addresses of several ballasts can be swapped using this function block. In order to do this, however, it is necessary that a free, unused short address is present in the DALI line.

In the parameter arrSwapShortAddressList, a list of the ballasts whose short addresses are to be changed is transferred. The index of the structure thereby corresponds to the short address of the ballast. The element nNewShortAddress contains the new short address. bShortAddressValid must test to TRUE in order that the short address of the respective ballast will be changed. Applying a rising edge to the bStart input starts the block, and the bBusy output goes TRUE. Depending on the chosen options ( nOptions parameter), all lamps will be set to the value MIN LEVEL. The elements of the output arrSwapedShortAddresses are reset. If the new short address is set for a ballast, the corresponding element in the output arrSwapedShortAddresses is set to TRUE. If the option DALIV2_OPTION_OPTICAL_FEEDBACK is active, the lamp will in addition be set to the value MAX LEVEL.

VAR_INPUT

bStart                   : BOOL;
bCancel                  : BOOL;
nFreeShortAddress        : BYTE;
nOptions                 : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the swapping of the short addresses.

nFreeShortAddress: Free short address (0 – 63).

nOptions: Options for swapping short addresses (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_OPTICAL_FEEDBACK | Before swapping the short addresses, all ballasts are set to MIN LEVEL. After assigning the new short address, the brightness of the respective ballast will be changed to MAX LEVEL.

VAR_OUTPUT

bBusy                    : BOOL;
bError                   : BOOL;
nErrorId                 : UDINT;
arrSwapedShortAddresses  : ARRAY [0..63] OF BOOL;

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.

arrSwapedShortAddresses: If the new short address has been set for a ballast, the corresponding element will be set in the array. The array index reflects the short address of the ballast.

VAR_IN_OUT

arrSwapShortAddressList  : ARRAY [0.. 63] OF ST_DALIV2SwapShortAddressList;
stCommandBuffer          : ST_DALIV2CommandBuffer;

arrSwapShortAddressList: A reference to the list containing the short addresses to be swapped.


Power Control - Function Blocks

Name | Description
FB_DALIV2ConstantLightControlEco | Simple function block for constant light control of DALI devices.
FB_DALIV2Dimmer1Switch | Function block for dimming DALI devices with one button.
FB_DALIV2Dimmer1SwitchEco | Memory saving version of FB_DALIV2Dimmer1Switch with no special functions.
FB_DALIV2Dimmer1SwitchMultiple | Function block for dimming DALI devices with one button. For applications in which up to five DALI lines (0..4) can be installed.
FB_DALIV2Dimmer2Switch | Function block for dimming DALI devices with two buttons.
FB_DALIV2Dimmer2SwitchEco | Memory saving version of FB_DALIV2Dimmer2Switch with no special functions.
FB_DALIV2Light | Function block for controlling lighting.
FB_DALIV2LightControl | Daylight lamp control with up to 30 nodes.
FB_DALIV2Ramp | Function block creating a ramp.
FB_DALIV2Sequencer | Function-block to program light-sequences with up to 50 different steps.
FB_DALIV2StairwellDimmer | Function block for stairwell-lighting-control


FB_DALIV2ConstantLightControlEco

The block FB_DALIV2ConstantLightControlEco() is used for constant light control with DALI ballasts.

The system tries to match the a specified set value through cyclic dimming. The control dynamics are determined by a dead time (tDeadTime). The dead time defines the delay between the individual commands for changing the control value. The smaller the dead time, the faster the control. A freely definable hysteresis (nHysteresis) prevents continuous oscillation around the set value. If the actual value is within the hysteresis range around the set value, the lamps brightness remains unchanged. An option is available for specifying whether the lamps should be switched on and off automatically (see table below).

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. 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bEnable                    : BOOL := TRUE;
bOn                        : BOOL;
bOff                       : BOOL;
bToggle                    : BOOL;
nSetpointValue             : UINT := 500;
nActualValue               : UINT;
nHysteresis                : UINT := 50;
tDeadTime                  : TIME := t#10s;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;
nOptions                   : DWORD := 0;

bEnable: Enables the block. If this input is FALSE, the inputs bOn, bOff and bToogle are disabled. No control values are output.

bOn: Switches the addressed devices to MAX_LEVEL and activates constant light control.

bOff: Switches the addressed devices off and disables constant light control.

bToggle: The lighting is switched on or off, depending on the state of the reference device.

nSetpointValue: This input is used for specifying the set value.

nActualValue: The actual value is applied at this input.

nHysteresis: Control hysteresis around the set value. If the actual value is within this range, the control values for the lamps remain unchanged.

tDeadTime: Dead time between the individual commands used for changing the control value for the DALI lamps.

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.

nOptions: Options (see table). The individual constants must be linked with OR operators.

Constants | Description
DALIV2_OPTION_SWITCH_ON_AND_OFF | The DALI commands ON_AND_STEP_UP and STEP_DOWN_AND_OFF are used for changing the control value. This causes the lamps to be switched off when MIN_LEVEL is reached. If the control deviation is above the hysteresis, the lamps are switched on again. If this option is not set, the commands STEP_UP and STEP_DOWN are used. In this cases the lamps remain switched on continuously.
DALIV2_OPTION_SWITCH_ON_WITH_MIN_LEVEL | If the light is switched on again by the constant light control, this option always uses the command MIN_LEVEL. If the option is not set, MAX_LEVEL is used. This option is available from V2.9.3 of the PLC library.

VAR_OUTPUT

nActualLevelMasterDev   : BYTE;
nDeviation              : INT;
bControllerIsActive     : BOOL;
bBusy                   : BOOL;
bError                  : BOOL;
nErrorId                : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

nDeviation: Current control deviation (set value/actual value).

bControllerIsActive: This output is set once the control is activated.

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Dimmer1Switch

An individual DALI lamp, a DALI group or a complete DALI line can be switched and dimmed using a single switch through this block.

Operating by means of the bSwitchDimm input

The light is switched on or off by a short signal at the bSwitchDimm input. Dimmer mode will be activated if the signal remains for longer than tSwitchOverTime (typical recommended value: 200ms). The output signal then cycles between nMinLevelMasterDev and nMaxLevelMasterDev. In order to be able to set the maximum or minimum value more easily, the output signal pauses at the level of the maximum and minimum values for the time given by tCycleDelay. When the signal is once more removed, the output signal being generated at that time is retained. Another pulse at the input will set the output to 0. If the bSwitchDimm is briefly removed in dimmer mode, the component changes the direction of dimming.

Operation by means of the bOn and bOff inputs

The light is immediately switched on or off if a rising edge is applied to the bOn or bOff inputs. The output value is set to 0 when switching off. The switch-on behaviour can be affected by the memory function (see below).

Operation by means of the bSetDimmValue and nDimmValue inputs

If the value of nDimmValue changes the devices concerned will be switched to this brightness value immediately. The significant point here is that the value changes. The lighting is switched off by changing the value to 0. If there is a rising edge at the bSetDimmValue input, the value of nDimmValue immediately appears at the output. Immediate modification of the output can be suppressed by a static 1- signal at the bSetDimmValue input. This makes it possible to apply a value to the nDimmValue input, but for this value only to be passed to the output at the next rising edge of bSetDimmValue.

The bSetDimmValue and nDimmValue inputs can be used to implement a variety of lighting scenarios. Using nDimmValue to set the outputs directly can be used to achieve particular brightness levels, either directly or by continuously changing the value. nDimmValue must have a value between nMinLevelMasterDev and nMaxLevelMasterDev. The value 0 is an exception. If the value is outside this range, the output value is limited to the upper or lower limit, as appropriate.

The memory function

It is necessary to determine whether the memory function (bMemoryModeOn input) is active or not at switch-on. If the memory function is active, then the last set value is adopted as the brightness value as soon as the device is switched on. If the memory function is not active, a brightness specified by the nOnValueWithoutMemoryMode parameter is assigned to the devices concerned. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or the bSwitchDimm input. It should be noted that the nOnValueWithoutMemoryMode parameter must lie between nMinLevelMasterDev and nMaxLevelMasterDev. If this is not the case, the output value is adjusted to the upper or lower limit, as appropriate.

Comment on the tSwitchOverTime parameter

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimm input can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

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. 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bSwitchDimm                : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
tCycleDelay                : TIME := t#500ms;
bMemoryModeOn              : BOOL := FALSE;
nOnValueWithoutMemoryMode  : BYTE := 254;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
nMinLevelMasterDev         : BYTE := 126;
nMaxLevelMasterDev         : BYTE := 254;
tCycleActualLevelMasterDev : TIME := t#0s;

bSwitchDimm: Switches or dims the addressed devices.

bOn: Switches the addressed devices to the last output value, or to the value specified by nOnValueWithoutMemoryMode.

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

bSetDimmValue: A positive edge at this input sets the addressed devices immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimm input.

tCycleDelay: Delay time, if either the minimum or maximum value is reached.

bMemoryModeOn: Switches over to use the memory function, so that the previous value is written to the output as soon as it is switched on.

nOnValueWithoutMemoryMode: Value at switch on if the memory function is not active.

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.

nMinLevelMasterDev: The minimum value of the master device.

nMaxLevelMasterDev: The maximum value of the master device.

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

nActualLevelMasterDev     : BYTE;
bBusy                     : BOOL;
bError                    : BOOL;
nErrorId                  : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Dimmer1SwitchEco

The FB_DALIDimmer1SwitchEco() block is a variant of FB_DALIV2Dimmer1Switch() that saves memory space. It does not include the special "Switch memory function off" function.

Operating by means of the bSwitchDimm input

The light is switched on or off by a short signal at the bSwitchDimm input. If the signal remains for longer than tSwitchOverTime (recommended value: 200 ms), dimmer mode is activated and the brightness increases or decreases steadily. The dimming direction is changed by briefly removing the bSwitchDimm signal.

Operation by means of the bOn and bOff inputs

The light is immediately switched on or off if a rising edge is applied to the bOn or bOff inputs. The output value is set to 0 when switching off.

Operation by means of the bSetDimmValue and nDimmValue inputs

If the value of nDimmValue changes the devices concerned will be switched to this brightness value immediately. The significant point here is that the value changes. The lighting is switched off by changing the value to 0. If there is a rising edge at the bSetDimmValue input, the value of nDimmValue immediately appears at the output. Immediate modification of the output can be suppressed by a static 1- signal at the bSetDimmValue input. This makes it possible to apply a value to the nDimmValue input, but for this value only to be passed to the output at the next rising edge of bSetDimmValue.

The bSetDimmValue and nDimmValue inputs can be used to implement a variety of lighting scenarios.Using nDimmValue to set the outputs directly can be used to achieve particular brightness levels, either directly or by continuously changing the value.

The memory function

In contrast to FB_DALIV2Dimmer1Switch(), where the memory function can be switched on or off through the bMemoryModeOn input, the memory function is always active on this memory-saving version. This means that the most recently set value is adopted for the brightness when switching on. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or the bSwitchDimm input.

Comment on the tSwitchOverTime parameter

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimm input can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

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. 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bSwitchDimm                : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;

bSwitchDimm: Switches or dims the addressed devices.

bOn: Switches the addressed devices to the most recent output value.

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

bSetDimmValue: A positive edge at this input sets the addressed devices immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimm input.

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

nActualLevelMasterDev     : BYTE;
bBusy                     : BOOL;
bError                    : BOOL;
nErrorId                  : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Dimmer1SwitchMultiple

Function block for switching and dimming DALI devices with one button. For applications in which up to five DALI lines (0..4) can be installed. The basic function of this function block can be found in the description of FB_DALIV2Dimmer1Switch().

VAR_INPUT

bSwitchDimm                : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
tCycleDelay                : TIME := t#500ms;
bMemoryModeOn              : BOOL := FALSE;
nOnValueWithoutMemoryMode  : BYTE := 254;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
nMasterDevLine             : BYTE := 0;
nMinLevelMasterDev         : BYTE := 126;
nMaxLevelMasterDev         : BYTE := 254;
tCycleActualLevelMasterDev : TIME := t#0s;
nDALILineEnable            : BYTE := 2#0000_0001;

bSwitchDimm: Switches or dims the addressed devices on all the activated DALI lines.

bOn: Switches the addressed devices on all the activated DALI lines to the last output value, or to the value specified by nOnValueWithoutMemoryMode.

bOff: Switches the addressed devices on all the activated DALI lines off (value 0).

bSetDimmValue: A positive edge at this input sets the addressed devices on all the activated DALI lines immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimm input.

tCycleDelay: Delay time, if either the minimum or maximum value is reached.

bMemoryModeOn: Switches over to use the memory function, so that the previous value is written to the output as soon as it is switched on.

nOnValueWithoutMemoryMode: Value at switch on if the memory function is not active.

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 (0 - 63).

nMasterDevLine: The line on which the master device for group and common configurations is located. Depending on the function block, there is only one master device that is to be selected from one of the activated DALI lines. The lines are numbered from 0 to 4.

nMinLevelMasterDev: The minimum value of the master device.

nMaxLevelMasterDev: The maximum value of the master device.

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.

nDALILineEnable: Input variable in the form of a bit-pattern. A 1 in the bit-pattern indicates that the DALI line is active. Example: 2#01001 indicates that DALI lines 0 and 3 are active.

VAR_OUTPUT

nActualLevelMasterDev : BYTE;
bBusy                 : BOOL;
bError                : BOOL;
nErrorId              : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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

stCommandBuffer00   : ST_DALIV2CommandBuffer;
stCommandBuffer01   : ST_DALIV2CommandBuffer;
stCommandBuffer02   : ST_DALIV2CommandBuffer;
stCommandBuffer03   : ST_DALIV2CommandBuffer;
stCommandBuffer04   : ST_DALIV2CommandBuffer;

stCommandBuffer00 - stCommandBuffer04: References to the structures for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Dimmer2Switch

The functions available in the FB_DALIDimmer2Switch() function block correspond to those in the FB_DALIV2Dimmer1Switch() function block. The difference is simply that two switches are connected to the FB_DALIDimmer2Switch() function block. This allows the user to choose specifically between dimming up or dimming down.

Operation by means of the bSwitchDimmUp and bSwitchDimmDown inputs

The light is switched on or off by a short signal at the bSwitchDimmUp or bSwitchDimmDown inputs. Dimmer mode will be activated if the signal remains for longer than tSwitchOverTime (typical recommended value: 200ms). The addressed devices are now dimmed to the levels specified by nMaxLevelMasterDev and nMinLevelMasterDev. When the signal is once more removed, the output signal being generated at that time is retained. Another pulse at one of the inputs will set the output to 0.

Operation by means of the bOn and bOff inputs

The light is immediately switched on or off if a rising edge is applied to the bOn or bOff inputs. The output value is set to 0 when switching off. The switch-on behaviour can be affected by the memory function (see below).

Operation by means of the bSetDimmValue and nDimmValue inputs

If the value of nDimmValue changes the devices concerned will be switched to this brightness value immediately. The significant point here is that the value changes. The lighting is switched off by changing the value to 0. If there is a rising edge at the bSetDimmValue input, the value of nDimmValue immediately appears at the output. Immediate modification of the output can be suppressed by a static 1- signal at the bSetDimmValue input. This makes it possible to apply a value to the nDimmValue input, but for this value only to be passed to the output at the next rising edge of bSetDimmValue.
The bSetDimmValue and nDimmValue inputs can be used to implement a variety of lighting scenarios. Using nDimmValue to set the outputs directly can be used to achieve particular brightness levels, either directly or by continuously changing the value. nDimmValue must have a value between nMinLevelMasterDev and nMaxLevelMasterDev. The value 0 is an exception. If the value is outside this range, the output value is limited to the upper or lower limit, as appropriate.

The memory function

It is necessary to determine whether the memory function (bMemoryModeOn input) is active or not at switch-on. If the memory function is active, then the last set value is adopted as the brightness value as soon as the device is switched on. If the memory function is not active, a brightness specified by the nOnValueWithoutMemoryMode parameter is assigned to the devices concerned. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or the bSwitchDimmUp / bSwitchDimmDown input. It should be noted that the nOnValueWithoutMemoryMode parameter must lie between nMinLevelMasterDev and nMaxLevelMasterDev. If this is not the case, the output value is adjusted to the upper or lower limit, as appropriate.

Comment on the tSwitchOverTime parameter

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimmUp and bSwitchDimmDown inputs can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

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. 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bSwitchDimmUp              : BOOL;
bSwitchDimmDown            : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
bMemoryModeOn              : BOOL := FALSE;
nOnValueWithoutMemoryMode  : BYTE := 254;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
nMinLevelMasterDev         : BYTE := 126;
nMaxLevelMasterDev         : BYTE := 254;
tCycleActualLevelMasterDev : TIME := t#0s;

bSwitchDimmUp: Switches or dims the addressed devices up.

bSwitchDimmDown: Switches or dims the addressed devices down.

bOn: Switches the addressed devices to the last output value, or to the value specified by nOnValueWithoutMemoryMode.

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

bSetDimmValue: A positive edge at this input sets the addressed devices immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimmUp and bSwitchDimDown inputs.

bMemoryModeOn: Switches over to use the memory function, so that the previous value is written to the output as soon as it is switched on.

nOnValueWithoutMemoryMode: Value at switch on if the memory function is not active.

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.

nMinLevelMasterDev: The minimum value of the master device.

nMaxLevelMasterDev: The maximum value of the master device.

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

nActualLevelMasterDev : BYTE;
bBusy                 : BOOL;
bError                : BOOL;
nErrorId              : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Dimmer2SwitchEco

The FB_DALIDimmer2SwitchEco() block is a variant of FB_DALIV2Dimmer2Switch() that saves memory space. It does not include the special "Switch memory function off" function.

Operation by means of the bSwitchDimmUp and bSwitchDimmDown inputs

The light is switched on or off by a short signal at the bSwitchDimmUp or bSwitchDimmDown inputs. Dimmer mode will be activated if the signal remains for longer than tSwitchOverTime (typical recommended value: 200ms). The addressed devices are now dimmed. When the signal is once more removed, the output signal being generated at that time is retained. Another pulse at one of the inputs will set the output to 0.

Operation by means of the bOn and bOff inputs

The light is immediately switched on or off if a rising edge is applied to the bOn or bOff inputs. The output value is set to 0 when switching off.

The memory function

In contrast to FB_DALIV2Dimmer2Switch(), where the memory function can be switched on or off through the bMemoryModeOn input, the memory function is always active on this memory-saving version. This means that the most recently set value is adopted for the brightness when switching on. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or the bSwitchDimm input.

Comment on the tSwitchOverTime parameter

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimmUp and bSwitchDimmDown inputs can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

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. 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bSwitchDimmUp              : BOOL;
bSwitchDimmDown            : BOOL;
bOn                        : BOOL;
bOff                       : BOOL;
bSetDimmValue              : BOOL;
nDimmValue                 : BYTE;
tSwitchOverTime            : TIME := t#400ms;
nAddr                      : BYTE := 0;
eAddrType                  : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr             : BYTE := 0;
tCycleActualLevelMasterDev : TIME := t#0s;

bSwitchDimmUp: Switches or dims the addressed devices up.

bSwitchDimmDown: Switches or dims the addressed devices down.

bOn: Switches the addressed devices to the most recent output value.

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

bSetDimmValue: A positive edge at this input sets the addressed devices immediately to the brightness value that is asserted at the nDimmValue input. If the value of nDimmValue changes, the brightness value is set immediately to the changed value if the bSetDimmValue input is FALSE.

nDimmValue: see bSetDimmValue.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimm input.

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

nActualLevelMasterDev : BYTE;
bBusy                 : BOOL;
bError                : BOOL;
nErrorId              : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Light

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.

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. 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 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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2LightControl

Daylight-Lamp-control.

This function-block is based upon a table of 30 nodes containing measured input- and control-values for threshold-switching. If the actual value comes within the range of a new node (arrControlTable[n].nActualValue-arrControlTable[n].nSwitchRange/2 ...arrControlTable[n].Input+arrControlTable[n].nSwitchRange/2), the actual control value will change (see diagram). The threshold-switch is followed by a ramp-function which ramps the control value to the new control value over the time tRampTime. With a rising-edge at bOn the light is switched immediately to the nearest control value and similarily a rising edge at bOff switches the light off without the delay of a ramp. It is possible to trigger a positive edge on bOn or bOff at anytime.

It is not required to use all 30 entries in the node table. The first element with a nSwitchRange of "0" will mark the beginning of the unused table-range.

Comment on the nMasterDevAddr parameter

The DALI system provides facilities for controlling lamps individually or as groups. The individual devices can be members of a variety of groups and as a result, prior to the issue of a group or common control command the individual lamps may have different brightness levels. To determine whether or not the lamps 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bEnable                          : BOOL := TRUE;
bOn                              : BOOL;
bOff                             : BOOL;
nActualValue                     : UINT;
tRampTime                        : TIME := t#30s;
arrControlTable                  : ARRAY[1..30] OF ST_DALIV2ControlTable;
nOptions                         : DWORD := 0;
nAddr                            : BYTE := 0;
eAddrType                        : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr                   : BYTE := 0;
tCycleActualLevelMasterDev       : TIME := t#0s;

bEnable: A positive input enables the function block. A negative state deactivates the inputs and sets the function-block to the idle-mode, after the last necessary DALI-commands are sent. Except for the cyclic query of the light-level of the master-device, the function-block sends no further DALI-commands.

bOn: A rising edge sets the addressed lamps directly to the next control value.

bOff: A rising edge turns the addressed lamps immediately off.

nActualValue: measured light-value.

tRampTime: time to drive the lamp from the actual value to the new control value. (Preset value: 30s).

arrControlTable: Input-/control-value-table. arrControlTable[1] to arrControlTable[30] of ST_DALIV2ControlTable

nOptions: Reserved for future developments.

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. In order not to disturb the dimming of the lamps, reading always has the lowest priority. If the value is set to 0, reading is deactivated.

VAR_OUTPUT

nActualLevelMasterDev  : BYTE;
bBusy                  : BOOL;
bControlActive         : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;

nActualLevelMasterDev: The current control value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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

bControlActive: This output is set once the control is activated.

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. bError 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. nErrorId 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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Ramp

Function-block creating a light-ramp.

With a rising-edge at bOn the light will be switched immediately to the maximum-level of the master-device and a rising edge at bOff turns the light off. Triggering the input bToggle inverts the actual light-state. A rising-edge at bStart starts dimming the light from the actual to the end-level (nEndLevel) - the required time is defined by tRampTime.

As long as bEnable is TRUE all inputs are active, otherwise the controlling inputs bOn, bOff, bToggle and bStart are deactivated and the function-block turns to its idle-mode. With every start of the dim-ramp the target-value nEndLevel is checked if it is within the allowed range of the DALI-Master-Device (MIN LEVEL ... MAX LEVEL or „0“).

Ramp-Calculation

The functionality of this function-block is based on whether up- or down-dimming has been selected through the OnAndStepUp- or StepDownAndOff-command. The required number of step-commands are calculated and sent to the lamps equally distributed over the ramp-time.
For ramp times less than 11s it is possible that the calculated time for one step will be less than the time required to run the commands themselves. To achieve these short ramp times (<11s), the function block switches its mode . It will no longer work with a calculated number of steps, but rather with a single DirectArcPower-command. This command dims the addressed lamps from their actual-level to the end-level in a specified FADE TIME which is programmed in the control-devices of the lamps. 16 different values are possible for this Fade-Time:

nFadeTime | tFadeTime (s)
0 | <0,0707
1 | 0,707
2 | 1,000
3 | 1,414
4 | 2,000
5 | 2,828
6 | 4,000
7 | 5,657
8 | 8,000
9 | 11,314
10 | 16,000
11 | 22,627
12 | 32,000
13 | 45,255
14 | 64,000
15 | 90,510

The value closest to the desired ramp-time will be taken and programmed into all selected devices. For example, with a desired ramp-time of 6s the function block will select level7 = 5,657 s. After driving the ramp successfully, all selected devices will be re-programmed with the original Fade-Time of the master-device.

During the ramp-driving the output-value nActualLevelMasterDev will be given as a calculated value, in order not to stress the DALI-Bus with query-commands. This calculation is based upon the difference of start- and end-level and the selected ramp-time from the table above. Because this value is a calculated one it may not be exact at any time and is only to be seen as an orientation. After the ramp-driving a query-command is sent to read an exact value for nActualLevelMasterDev.

Comment on the nMasterDevAddr parameter

The DALI system provides facilities for controlling lamps individually or as groups. The individual devices can be members of a variety of groups and as a result, prior to the issue of a group or common control command the individual lamps may have different brightness levels. To determine whether or not the lamps 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort.In this case, the nMasterDevAddr parameter has no significance.

VAR_INPUT

bEnable                          : BOOL := TRUE;
bOn                              : BOOL;
bOff                             : BOOL;
bToggle                          : BOOL;
bStart                           : BOOL;
nEndLevel                        : BYTE := 254;
tRampTime                        : TIME := t#8s;
nOptions                         : DWORD := 0;
nAddr                            : BYTE := 0;
eAddrType                        : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr                   : BYTE := 0;
tCycleActualLevelMasterDev       : TIME := t#0s;

bEnable: A positive input enables the function block. A negative state deactivates the inputs bOn, bOff, bToggle and bStart and sets the function-block to the idle-mode, after the last necessary DALI-commands are sent. Except for the cyclic query of the light-level of the master-device, the function-block sends no further DALI-commands.

bOn: A rising edge sets the addressed lamps directly to the maximum-level of the master-device.

bOff: A rising edge turns the addressed lamps immediately off.

bToggle: Rising edges at this input toggle the state the addressed lamps.

bStart: This input starts the dim-ramp from the actual value (of the master-device) to the target-value nEndLevel within the time defined as tRampTime. This can be interrupted by bOn, bOff or bToggle at any time.

nEndLevel: Target-value of the dim-ramp. (Valid range: 0 or MIN LEVEL ... MAX LEVEL).

tRampTime: Ramp-time, see bStart. (initial value: 8s).

nOptions: Reserved for future developments.

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. In order not to disturb the dimming of the lamps, reading always has the lowest priority. If the value is set to 0, reading is deactivated.

VAR_OUTPUT

nActualLevelMasterDev           : BYTE;
bBusy                           : BOOL;
bError                          : BOOL;
nErrorId                        : UDINT;

ActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

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. bError 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. nErrorId 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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Sequencer

Function-block to program light-sequences with up to 50 different steps.

This function-block is based upon a ramp-function, which drives to specific light-values in a specific time. When the light-value is reached, the light will stay on this level for an adjustable time. After that, the ramp to the next value will be started. The table consists of 50 elements containing the target-value (nTargetValue), the ramp-time (tRampTime) and the time staying on the reached light-level (tProlongTime). It is not required to use all 50 elements of the table. An element containing only zeros for the target-value, ramp-time and prolong-time will be recognized as the end of a sequence. Furthermore it is possible to let a sequence start at a specific position with the input-value nStartIndex. With this it is possible to program different light-sequences within the 50 elements of the table which are separated by simple zero-elements (delimiters).

The light-level programmed with sequence No.1, for example, will show the following behavior (nStartIndex=1, nOptions.bit0=TRUE, explanations see below):

Moreover the function-block has inputs to switch the light on and off (on: maximum Level, off: 0) as well as an input bToggle to invert the actual light-state. All inputs are only active, if bEnable is set to TRUE. If bEnable is reset to FALSE, all inputs are inactive and nActualLevelMasterDev will remain on its actual value.

NOTE: As already described above, this function-block is based upon the FB_DALIV2Ramp. Regarding the ramp-time the Ramp-Function tries to be as exactly as possible. However it is necessary, that values are queried out of the devices. These commands take some time of their own, which depends on the entered cycle-time. So the real ramp-time might differ from the programmed time.

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;

bEnable: A positive input enables the function block. A negative state deactivates the inputs the inputs bOn, bOff, bToggle and bStart and sets the function-block to the idle-mode.

bOn: A rising edge sets the output nLightLevel directly to the maximum-level.

bOff: A rising edge sets the output nLightLevel immediately to "0".

bToggle: Rising edges at this input toggle the light.

bStart: This input lets the sequence begin with the element defined with nStartIndex.

nStartIndex: See bStart.

arrSequenceTable: Light-value-table with the information about the target-value, the ramp-time and the prolong-time.

nOptions: Parameter-input. Setting (resp. not-setting) of the single bits will affect the behavior of the function-block as follows:

Bit | Description
0 | not set: After running through a sequence, the function-block will stop its activity. In order to start again, a rising edge at bStart is necessary. set: After running through a sequence, the function-block will automatically restart at the element defined with nStartIndex.
1 - 31 | -- reserved for future developments --

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. In order not to disturb the dimming of the lamps, reading always has the lowest priority. If the value is set to 0, reading is deactivated.

VAR_OUTPUT

nActualLevelMasterDev           : BYTE;
nActualIndex                    : USINT;
bLight                          : BOOL;
bSequenceActive                 : BOOL;
bBusy                           : BOOL;
bError                          : BOOL;
nErrorId                        : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

nActualIndex : This output shows the actual element of the light-sequence. If the sequence is finished or stopped (bSequenceActive = FALSE , see below) , the output will fall back to "0".

bLight: As long as nLightLevel is greater than "0", this output is set to TRUE.

bSequenceActive: As long as a light-sequence is running, this output is set to TRUE.

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. bError 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. nErrorId 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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StairwellDimmer

Function block to control stairwell lighting.

A rising edge at the input bSwitch switches the addressed lamps to the value nPresenceValue. A falling edge on bSwitch starts or restarts a timer with the time tPresenceDuration. Following the expiry of this timer, the lamps are dimmed to the value nProlongValue over the time period tFadeOffDuration. This value is maintained for the time period tProlongDuration. After that, the light is switched off. A rising edge at the input bOff turns the light off immediately. Triggering the input bSwitch again will always restart the cycle, even during the periods of tPresenceDuration and tFadeOffDuration. With every start the setpoint-values are checked if they are within the allowed range of the DALI-Master-Device (MIN LEVEL ... MAX LEVEL or „0“) .

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. The individual devices can be members of a variety of groups and as a result, prior to the issue of a group or common control command the individual lamps may have different brightness levels. To determine whether or not the lamps 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 block is to be used to control a single lamp, eAddrType = eAddrTypeShort. In this case, the nMasterDevAddr parameter has no significance.

It is possible, that nPresenceValue is lower than nProlongValue or both values are equal.

VAR_INPUT

bEnable                     : BOOL := TRUE;
bSwitch                     : BOOL;
bOff                        : BOOL;
nPresenceValue              : BYTE := 254;
nProlongValue               : BYTE := 200;
tPresenceDuration           : TIME := t#30s;
tFadeOffDuration            : TIME := t#10s;
tProlongDuration            : TIME := t#20s;
nOptions                    : DWORD := 0;
nAddr                       : BYTE := 0;
eAddrType                   : E_DALIV2AddrType := eDALIV2AddrTypeShort;
nMasterDevAddr              : BYTE := 0;
tCycleActualLevelMasterDev  : TIME := t#0s;

bEnable: A positive input enables the function block. A negative state deactivates the inputs and sets the function-block to the idle-mode, after the last necessary DALI-commands are sent. Except for the cyclic query of the light-level of the master-device, the function-block sends no further DALI-commands.

bSwitch: A rising edge sets the light to nPresenceValue. A falling edge starts the presence time (see diagram).

bOff: Turns the light off immediately.

nPresenceValue: Value to which the light should be set during the presence time. (Valid range: 0 or MIN LEVEL ... MAX LEVEL - Preset value: 254).

nProlongValue: Value to which the light should be set to following a falling edge on bSwitch after the time tPresenceDuration. (Valid range: 0 or MIN LEVEL ... MAX LEVEL - Preset value: 200).

tPesenceDuration: Duration of the presence time in which the light is set to nPresenceValue following a falling edge on bSwitch. (Preset value: 30 seconds).

tFadeOffDuration: Within this time the light is driven from the presence- to the prolong-value (Preset value: 10 seconds).

tProlongDuration: Duration of the dwell time. (Preset value: 20 seconds).

nOptions: Reserved for future developments.

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. In order not to disturb the dimming of the lamps, reading always has the lowest priority. If the value is set to 0, reading is deactivated.

VAR_OUTPUT

nActualLevelMasterDev   : BYTE;
bBusy                   : BOOL;
bError                  : BOOL;
nErrorId                : UDINT;

nActualLevelMasterDev: The current output value of the master device (if eAddrType = eAddrTypeShort this is always the device being addressed at the time).

bBusy: This output is set during light-change, which means turning on, off and driving a ramp. The start- and end-value are not significant. Even driving a ramp from 100 to 100 in 10s will set this output to TRUE.

bCycleActive: When the block is activated the output is set, and it remains active until the cycle 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. bError 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. nErrorId 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 (the buffer) with the FB_DALIV2Communication() block.


Tridonic - Function Blocks

Name | Description
FB_DALIV2SmartSPOT | This block cyclically reads the status of a smartSPOT sensor or MSensor 02 and scales the measured brightness and detected presence based on the received value.


FB_DALIV2SmartSPOT

This block cyclically reads the status of a smartSPOT sensor or MSensor 02 and scales the measured brightness and detected presence based on the received value.

Two different cycle times can be specified, i.e. a cycle time that is used if no presence was detected, and a cycle time that is used for active presence. In this way access to the DALI bus can be minimised. If presence is detected a slower cycle time (e.g. 20 s) can usually be selected, because lighting control and switching off the lighting is not time-critical. Without presence a shorter cycle time (e.g. 2 s) should be selected in order to minimise the response time for switching on the lighting when a person enters the room.

The measured brightness of the sensor depends on the reflection of the furniture in the room. The measured value is only 20 to 40% of the actual brightness of the respective surface. Example: 500 lux on a table with a reflectivity of 30% results in a brightness value of 150 lux. The measuring range of the sensor is designed for controlling standard workstation brightness values between 200 and 1000 lux.

If the block with MSensor 02 is to be used, it must be in slave mode.

Further information and a description of the electrical and physical properties can be found in the product description for the smartSPOT sensor or MSensor 02.

VAR_INPUT

bReadDirectly            : BOOL := FALSE;
tCycleTimeIfOccupancy    : TIME := t#20s;
tCycleTimeIfNoOccupancy  : TIME := t#2s;
nAddr                    : BYTE := 0;
eAddrType                : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority         : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bReadDirectly: The actual values are read immediately by a rising edge at this input.

tCycleTimeIfOccupancy: Cycle time for the read of the actual values during active presence.

tCycleTimeIfNoOccupancy: Cycle time for the read of the actual values during inactive presence.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bOccupancy    : BOOL;
nBrightness   : INT;
nRawValue     : BYTE;
bBusy         : BOOL;
bError        : BOOL;
nErrorId      : UDINT;

bOccupancy: The output is set if the sensor detects presence.

nBrightness: Measured brightness in lux.

nRawValue: Raw value before conversion.

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 (the buffer) with the FB_DALIV2Communication() block.


Interior Automation - Functions

Name | Description
FB_DALIV2IAPIR | This function cyclically reads the status of an IA PIR-sensor and scales the measured light intensity and the recognized presence of a person from the received value.


FB_DALIV2IAPIR

This function cyclically reads the status of an IA PIR-sensor and scales the measured light intensity and the recognized presence of a person from the received value.

There are two different cycle times allowed. One cycle time which is used if no presence of a person is recognized and another, which is used if the presence of a person is recognized.

Thus it is possible to minimize the accesses to the DALI-Bus. If the presence of a person is recognized, a slow cycle time (f. e. 20s) can be used, because the light regulation and the switching off of the lighting is not time-critical. If no presence of a person is recognized, a smaller cycle time (f. e. 2s) should be used. Thus the switching on of the lighting can be done with a minimized reaction time.

You can find more informations and a description of the electrical and physical properties in the product description of the IA PIR-sensor.

VAR_INPUT

bReadDirectly            : BOOL := FALSE;
tCycleTimeIfOccupancy    : TIME := t#20s;
tCycleTimeIfNoOccupancy  : TIME := t#2s;
nAddr                    : BYTE := 0;
eAddrType                : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority         : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bReadDirectly: with a positive edge at this input the module is activated.

tCycleTimeIfOccupancy: cycle time if a presence is recognized.

tCycleTimeIfNoOccupancy: cycle time if no presence is recognized.

nAddr: adress of a member or a group.

eAddrType: short adress, group adress or broadcast.

eCommandPriority: priority (high, medium or low), with which the command is executed by the library.

VAR_OUTPUT

bOccupancy    : BOOL;
nBrightness   : INT;
nRawValue     : BYTE;
bBusy         : BOOL;
bError        : BOOL;
nErrorId      : UDINT;

bOccupancy: this output is set, if the sonsor recognizes presence.

nBrightness: measured light intensity in Lux.

nRawValue: the value the sonsor read before conversion.

bBusy: this output is set, when the module is activated and stays active until the command is executed.

bError: this output is set TRUE, if an error occurs while a command is executed.

nErrorId: contains the command-specific error code of the command executed last. Is set back to 0, if a new command is executed. See Error codes.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: reference to the communication structure (buffer) of the FB_DALIV2Communication() function.

Development environment | Target system type | PLC library to include
TwinCAT 2.11 R3/x64 Build 2234 or higher | PC/CX, BX or BC | TcDALIV2-Library V2.9.0 or higher


Emergency Lighting - Introduction

The function blocks and variables for emergency lighting supply units with DALI interface are described below. All below function blocks described below call 'application-related expansion commands'. According to the DALI standard (IEC 62386) these commands are within the range 224 to 255. Because of the existence of a variety of application-related extension commands, it is necessary to use the FB_DALIV2EnableDeviceType() function block to specify which type of ballasts (emergency lighting, discharge lamps, ...) should react to the extension commands. A detailed description of the individual DALI commands and the variables for emergency lighting supply units can be found in Part 202 of the IEC 62386 standard.


Emergency Lighting - Variables

Each DALI emergency lighting supply unit has a certain number of variables (parameters) from which different information is read, or through which individual parameters can be modified.

Name | Default value | Reset value | Valid range | Size | Comment
EMERGENCY LEVEL | EMERGENCY MAX LEVEL | No change | EMERGENCY MIN LEVEL ... EMERGENCY MAX LEVEL or MASK | 1 byte |
EMERGENCY MIN LEVEL | Manufacturer-dependent | No change | 1 ... EMERGENCY MAX LEVEL or MASK | 1 byte | read only
EMERGENCY MAX LEVEL | Manufacturer-dependent | No change | EMERGENCY MIN LEVEL ... 254 or MASK | 1 byte | read only
PROLONG TIME | 4 | No change | 0 ... 255 | 1 byte |
TEST DELAY TIME | 0 | 0 | 00 00 ... FF FF | 2 bytes |
FUNCTION TEST DELAY TIME | 0 | No change | 00 00 ... FF FF | 2 bytes |
DURATION TEST DELAY TIME | 0 | No change | 00 00 ... FF FF | 2 bytes |
FUNCTION TEST INTERVAL | 7 | No change | 0, 1 ... 255 | 1 byte |
DURATION TEST INTERVAL | 13 | No change | 0, 1 ... 97 | 1 byte |
TEST EXECUTION TIMEOUT | 7 | No change | 0 ... 255 | 1 byte |
BATTERY CHARGE | ???? ???? | No change | 0 ... 255 | 1 byte |
DURATION TEST RESULT | 0 | No change | 0 ... 255 | 1 byte |
LAMP EMERGENCY TIME | 0 | No change | 0 ... 255 | 1 byte |
LAMP TOTAL OPERATION TIME | 0 | No change | 0 ... 255 | 1 byte |
RATED DURATION | Manufacturer-dependent | No change | 0 ... 255 | 1 byte | read only
EMERGENCY MODE | ???? ???? | No change | 0 ... 255 | 1 byte |
FEATURES | Manufacturer-dependent | No change | 0 ... 255 | 1 byte | read only
FAILURE STATUS | ???? ???? | No change | 0 ... 255 | 1 byte |
EMERGENCY STATUS | ???? ???? | No change | 0 ... 255 | 1 byte |
EXTENDED VERSION NUMBER | 1 | No change | 0 ... 255 | 1 byte | read only

?: Not specified

EMERGENCY LEVEL

This variable contains the emergency illuminance of the lamp. This value is limited via the variables EMERGENCY MAX LEVEL and EMERGENCY MIN LEVEL. The value can be read via the FB_DALIV2QueryEmergencyLevel() block.

EMERGENCY MIN LEVEL / EMERGENCY MAX LEVEL

The emergency illuminance is limited via the variables EMERGENCY MIN LEVEL and EMERGENCY MAX LEVEL within the ballast. The exceptions to this are power values of 0 (off) and 255 (mask). The EMERGENCY MIN LEVEL and EMERGENCY MAX LEVEL values are specified by the manufacturer of the ballast. The FB_DALIV2QueryEmergencyMinLevel() and FB_DALIV2QueryEmergencyMaxLevel() blocks can be used to read the two variables from the ballast.

PROLONG TIME

The prolong time defines how long emergency mode is extended after mains voltage is available again. The unit is 30 seconds per step. The value can be read from the ballast via the FB_DALIV2QueryTestTiming() block. The FB_DALIV2StoreDTRAsProlongTime() block is used to write to this variable.

TEST DELAY TIME

The variables FUNCTION TEST DELAY TIME, DURATION TEST DELAY TIME FUNCTION TEST INTERVAL and DURATION TEST INTERVAL are set by means of the TEST DELAY TIME variable. This specifies the time behaviour associated with the functional test and the duration test as follows:

Function test:
Use FB_DALIV2SetDTR() to write the high-order byte for the variable FUNCTION TEST DELAY TIME into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsTestDelayTimeHighByte() to write the content of the DTR into the high-order byte of the 16-bit variable TEST DELAY TIME.
Use FB_DALIV2SetDTR() to write the low-order byte for the variable FUNCTION TEST DELAY TIME into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsTestDelayTimeLowByte() to write the content the DTR into the low-order byte of the 16-bit-variable TEST DELAY TIME.
Use FB_DALIV2SetDTR() to write the value for the variable FUNCTION TEST INTERVAL into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsFunctionTestInterval() to write the content of the DTR into the variable FUNCTION TEST INTERVAL. The content of the variable TEST DELAY TIME is copied into the variable FUNCTION TEST DELAY TIME.

Duration test:
Use FB_DALIV2SetDTR() to write the high-order byte for the variable DURATION TEST DELAY TIME into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsTestDelayTimeHighByte() to write the content of the DTR into the high-order byte of the 16-bit variable TEST DELAY TIME.
Use FB_DALIV2SetDTR() to write the low-order byte for the variable DURATION TEST DELAY TIME into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsTestDelayTimeLowByte() to write the content the DTR into the low-order byte of the 16-bit-variable TEST DELAY TIME.
Use FB_DALIV2SetDTR() to write the value for the variable FUNCTION TEST INTERVAL into the DTR (data transfer register).
Use FB_DALIV2StoreDTRAsDurationTestInterval() to write the content of the DTR into the variable DURATION TEST INTERVAL. The content of the variable TEST DELAY TIME is copied into the variable DURATION TEST DELAY TIME.

FUNCTION TEST DELAY TIME

This variable is used to specify the delay time for the function test. Once this time has elapsed, the function test is executed for the first time. The unit of this variable is 15 minutes per step. This variable can be queried via the FB_DALIV2QueryTestTiming() block. TEST DELAY TIME is used to write to this variable (see above).

DURATION TEST DELAY TIME

This variable is used to specify the delay time for the duration test. Once this time has elapsed, the duration test is executed for the first time. The unit of this variable is 15 minutes per step. This variable can be queried via the FB_DALIV2QueryTestTiming() block. TEST DELAY TIME is used to write to this variable (see above).

FUNCTION TEST INTERVAL

This variable is used to specify the interval time for the function test. The function test is executed periodically at these intervals. The unit of this variable is 1 day per step. This variable can be queried via the FB_DALIV2QueryTestTiming() block. TEST DELAY TIME is used to write to this variable (see above).

DURATION TEST INTERVAL

This variable is used to specify the interval time for the duration test. The duration test is executed periodically at these intervals. The unit of this variable is 1 week per step. This variable can be queried via the FB_DALIV2QueryTestTiming() block. TEST DELAY TIME is used to write to this variable (see above).

TEST EXECUTION TIMEOUT

The function test or duration test can be interrupted through various events. The variable TEST EXECUTION TIMEOUT can be used to specify the maximum execution time within which the respective test must be completed. The unit of this variable is 1 day per step. This variable can be queried via the FB_DALIV2QueryTestTiming() block. The FB_DALIV2StoreDTRAsTestExecutionTimeout() block is used to write to this variable.

BATTERY CHARGE

The current state of battery charge can be retrieved via this variable. 0 means minimum load, 254 means maximum load. If the ballast is unable to determine the state of charge, this variable contains the value 255. The FB_DALIV2QueryBatteryCharge() block can be used to read this variable.

DURATION TEST RESULT

The result of a duration test is stored in this variable. The unit is 2 minutes per step. The value is only valid if bit 2 is set in the variable EMERGENCY STATUS (see below). The variable DURATION TEST RESULT can be queried with the function FB_DALIV2QueryDurationTestResult().

LAMP EMERGENCY TIME

The emergency mode operating period of the lamp (supply via rechargeable batteries) is stored in this variable. The unit is 1 hour per step. This variable can be queried with the FB_DALIV2QueryLampEmergencyTime() block and reset with the FB_DALIV2ResetLampTime() block.

LAMP TOTAL OPERATION TIME

The total lamp operating period is stored in this variable. The unit is 4 hours per step. This variable can be queried with the FB_DALIV2QueryLampTotalOperationTime() block and reset with the FB_DALIV2ResetLampTime() block.

RATED DURATION

The rated service time of the rechargeable battery is stored in this variable. The unit is 2 minutes per step. The value is specified by the manufacturer of the ballast and can be read with the FB_DALIV2QueryRatedDuration() block.

EMERGENCY MODE

In EMERGENCY MODE the ballast stores the current mode. The FB_DALIV2QueryEmergencyMode() block can be used to read the variable.

Bit | Description
0 | Reset mode. 0: No.
1 | Emergency mode readiness (normal operation). 0: No.
2 | Emergency mode. 0: No.
3 | Extended emergency mode once mains voltage is available again. 0: No.
4 | Function test active. 0: No.
5 | Duration test active. 0: No.
6 | Connected suppress push button is active. 0: Not active or not available.
7 | Connected mains voltage is active. 0: Off.

FEATURES

The performance characteristics supported by the ballast can be read from this variable via the FB_DALIV2QueryFeatures() block. The content of this variable is specified by the manufacturer of the ballast and cannot be modified.

Bit | Description
0 | Integrated emergency lighting supply unit. 0: No.
1 | Emergency lighting supply unit in continuous mode. 0: No.
2 | Switchable emergency lighting supply unit in continuous mode. 0: No.
3 | Auto test capability. 0: No.
4 | Adjustable emergency lighting illuminance. 0: No.
5 | Connected suppress push button is supported. 0: No.
6 | Physical selection is supported. 0: No.
7 | Reserved

FAILURE STATUS

Possible fault states are displayed in this variable and can be read with the FB_DALIV2QueryFailureStatus() block.

Bit | Description
0 | Fault in the ballast circuit. 0: No.
1 | Battery operation time fault. 0: No.
2 | Battery fault. 0: No.
3 | Emergency lamp fault. 0: No.
4 | Timeout during function test. 0: No.
5 | Timeout during duration test. 0: No.
6 | Function test failed. 0: No.
7 | Duration test failed. 0: No

EMERGENCY STATUS

The current state is displayed by the ballast. The FB_DALIV2QueryEmergencyStatus() block can be used to read the content of the variable.

Bit | Description
0 | Suppress mode. 0: No.
1 | Function test is completed and result is valid. 0: No.
2 | Duration test is completed and result is valid. 0: No.
3 | Battery charger ready for operation. 0: running.
4 | Start of function test delayed. 0: No.
5 | Start of duration test delayed. 0: No.
6 | Identification active. 0: No.
7 | Selected. 0: No

EXTENDED VERSION NUMBER

The extended version number can be read with the FB_DALIV2QueryExtendedVersionNumber() block. The version number can only be read, and is specified by the manufacturer of the ballasts.


Emergency Lighting - High-Level-Function Blocks

Name | Description
FB_DALIV2EmergencyLightingDT | This function-block executes a Duration-Test for a DALI-Emergency-Lighting-Device. At the end of the test, the results are put into a FIFO-buffer (IN-OUT-Variable fbStringRingBuffer). This buffer is read out by the function-block FB_DALIV2FileLogging() which writes all messages into a file.
FB_DALIV2EmergencyLightingFT | This function-block executes a Function-Test for a DALI-Emergency-Lighting-Device. At the end of the test, the results are put into a FIFO-buffer (IN-OUT-Variable fbStringRingBuffer). This buffer is read out by the function-block FB_DALIV2FileLogging() which writes all messages into a file.
FB_DALIV2FileLogging | This Function-Block reads all the data written into the FIFO-Buffer (IN-OUT-Variable fbStringRingBuffer) by either FB_DALIV2EmergencyLightingFT() or FB_DALIV2EmergencyLightingDT() and writes it into a file.
FB_DALIV2GetSettingsType01 | This function-block reads the variables (BATTERY CHARGE, DURATION TEST RESULT, LAMP EMERGENCY TIME, …) from all emergency lighting ballasts in a DALI line and stores them in a structure.
FB_DALIV2SetSettingsType01 | This function-block initialises the variables (EMERGENCY LEVEL, FUNCTION TEST DELAY TIME, DURATION TEST DELAY TIME, …) of all emergency lighting ballasts in a DALI line with the values that are stored in a structure.


FB_DALIV2EmergencyLightingDT

This function-block executes a Duration-Test for a DALI-Emergency-Lighting-Device. At the end of the test, the results are put into a FIFO-buffer (IN-OUT-Variable fbStringRingBuffer). This buffer is read out by the function-block FB_DALIV2FileLogging() which writes all messages into a file. Those events, which inhibit or interrupt the execution of a test will cause an error-output at bError and nErrorID and a message in the log-file.

The following events inhibit the execution of a Duration-Test:

  • The device is running in automatic Duration-Test-Mode. This means a test-time interval is programmed in the device.
  • A test is still active or pending (Function- or Duration-Test)
  • The battery of the emergency-lamp is not fully charged
  • The device is not in emergency-preparedness mode ("normal-mode") at the beginning of the test

These are the events, which can interrupt a Duration-Test:

  • The device does not reach the Duration-Test-mode after the start-command
  • The test is not finished correctly. This means, that the device is neither in the test-mode, nor back in the "normal mode" after starting the test.
  • An internal DALI-command was not executed correctly
  • The Timeout-time is elapsed

Note: This function-block is only available in the PC-based version of the DALIV2-library.

VAR_INPUT

bStart           : BOOL;
bStop            : BOOL;
nAddr            : BYTE;
sController      : STRING(20);
sLineName        : STRING(10);
sDescription     : STRING(20);
sLocation        : STRING(20);
stDateTime       : TIMESTRUCT;
tTimeout         : TIME := t#120m;

bStart: A rising edge activates the function-block.

bStop: When a Duration-test was successfully started, the Emergency-Mode and Emergency-Status will be periodically polled to see, if the test is finished and if any errors occurred. A rising edge at the bStop-Input will terminate the test at this stage, giving a special message in the log-file. This feature is neccessary, when it has only to be proven, that the emergency-device is running for a specific time - until the stop-signal is given.

nAddr: Address of the device.

sController: Name of the controller, as a description for the log-file.

sLineName: Name of the line.

sDescription: Further description of the device for the log-file.

sLocation: Location, where the lamp is installed.

stDateTime: Actual date and time.

tTimeout: The test has to be successfully executed in this time.

VAR_OUTPUT

tElapsedTestTime : TIME;
nEmergencyMode   : BYTE;
nEmergencyStatus : BYTE;
bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;

tElapsedTestTime: Test-duration. With a rising edge at bStart this value is first set to 0. As long as the function-block is active, it shows the elapsed test-time. With a falling edge at bBusy the output remains at its value, so the time, used for the test, is still available.

nEmergencyMode: During the test this output shows the internally quered value of the Emergency-Mode.

nEmergencyStatus: do. Emergency-Status.

bBusy: As long as the function-block is active, this output is set to TRUE.

bError: This output is switched to TRUE if an error occurs as described above. Is reset by the execution of a new test.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a new test. See Error codes.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;
fbStringRingBuffer : FB_MemRingBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

fbStringRingBuffer: Reference to the FIFO-Buffer, in which the log-entries are put.

A sample-program shows the correct assignment of the inputs as well as the link to the logger-FB FB_DALIV2FileLogging(). In this program the Duration-Test for the three emergency-devices will be executed on the 8th of every month.

The log-file will look like this:

In July the emergency-devices are not installed, yet. The tests result in DALI-command-errors on all devices.
In August the first device is installed, but the battery was not completely charged.
Finally, in September all devices are installed and fully functional. The tests were succesful.

When this file is opened, it may be neccessary to adjust the width of the columns, so all the data is visible.

Note: With this log-file opened, the file-logging-FB will not be able to write into the file and will collect the results until the file is properly closed.


FB_DALIV2EmergencyLightingFT

This function-block executes a Function-Test for a DALI-Emergency-Lighting-Device. At the end of the test, the results are put into a FIFO-buffer (IN-OUT-Variable fbStringRingBuffer). This buffer is read out by the function-block FB_DALIV2FileLogging() which writes all messages into a file. Those events, which inhibit or interrupt the execution of a test will cause an error-output at the bError and nErrorID and a message in the log-file.

The following events inhibit the execution of a Function-Test:

  • The device is running in automatic Function-Test-Mode. This means a test-time interval is programmed in the device.
  • A test is still active or pending (Function- or Duration-Test)
  • The device is not in emergency-preparedness mode ("normal-mode") at the beginning of the test

These are the events, which can interrupt a Function-Test:

  • The device does not reach the Function-Test-mode after the start-command
  • The test is not finished correctly. This means, that the device is neither in the test-mode, nor back in the "normal mode" after starting the test.
  • An internal DALI-command was not executed correctly
  • The Timeout-time is elapsed

Note: This function-block is only available in the PC-based version of the DALIV2-library.

VAR_INPUT

bStart           : BOOL;
nAddr            : BYTE;
sController      : STRING(20);
sLineName        : STRING(10);
sDescription     : STRING(20);
sLocation        : STRING(20);
stDateTime       : TIMESTRUCT;
tTimeout         : TIME := t#120m;

bStart: A rising edge activates the function-block.

nAddr: Address of the device.

sController: Name of the controller, as a description for the log-file.

sLineName: Name of the line.

sDescription: Further description of the device for the log-file.

sLocation: Location, where the lamp is installed.

stDateTime: Actual date and time.

tTimeout: The test has to be successfully executed in this time.

VAR_OUTPUT

tElapsedTestTime : TIME;
nEmergencyMode   : BYTE;
nEmergencyStatus : BYTE;
bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;

tElapsedTestTime: Test-duration. With a rising edge at bStart this value is first set to 0. As long as the function-block is active, it shows the elapsed test-time. With a falling edge at bBusy the output remains at its value, so the time, used for the test, is still available.

nEmergencyMode: During the test this output shows the internally queried value of the Emergency-Mode.

nEmergencyStatus: do. Emergency-Status.

bBusy: As long as the function-block is active, this output is set to TRUE.

bError: This output is switched to TRUE if an error occurs as described above. Is reset by the execution of a new test.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a new test. See Error codes.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;
fbStringRingBuffer : FB_MemRingBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

fbStringRingBuffer: Reference to the FIFO-Buffer, in which the log-entries are put.

A sample-program shows the correct assignment of the inputs as well as the link to the logger-FB FB_DALIV2FileLogging(). In this program the Function-Test for the three emergency-devices will be executed every Tuesday.

The log-file will look like this:

On 25th August the emergency-devices are not installed, yet. The tests result in DALI-command-errors on all devices.
On 1st September the first device is installed, but has still the internal automatic-test activated.
Finally, on 8th September all devices are installed and fully functional. The tests shows good results.

When this file is opened, it may be necessary to adjust the width of the columns, so all the data is visible.

Note: With this log-file opened, the file-logging-FB will not be able to write into the file and will collect the results until the file is properly closed.


FB_DALIV2FileLogging

This Function-Block reads all the data written into the FIFO-Buffer (IN-OUT-Variable fbStringRingBuffer) by either FB_DALIV2EmergencyLightingFT() or FB_DALIV2EmergencyLightingDT() and writes it into a file. After a successful execution of this Function-Block, the buffer is emptied.

Note: This function-block is only available in the PC-based version of the DALIV2-library.

VAR_INPUT

bStart             : BOOL;
sPathName          : STRING;
sNetId             : STRING;

bStart: A rising edge activates the function-block.

sPathName: Contains the path and file name for the buffer file to be opened. Note: The path can only point to the local computer’s file system! This means that network paths can not be used here!

sNetId: A string containing the network address of the TwinCAT computer where the buffer file is to be written or read can be given here. If it is to be run on the local computer, an empty string can be entered.

VAR_OUTPUT

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

bBusy: This output remains TRUE until the Function-block has emptied the log-buffer

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 ‘nErrId’.

nErrorId: Contains the command-specific ADS error code of the most recently executed command.

VAR_IN_OUT

fbStringRingBuffer   : FB_MemRingBuffer;

fbStringRingBuffer: Reference to the FIFO-Buffer, in which the log-entries are put.

A sample-program shows the correct assignment of the inputs as well as the link to the logger-FB FB_DALIV2FileLogging. The appearance of the log-files is shown under the description of the function-blocks FB_DALIV2EmergencyLightingDT() and FB_DALIV2EmergencyLightingFT().


FB_DALIV2GetSettingsType01

This function-block reads the variables (BATTERY CHARGE, DURATION TEST RESULT, LAMP EMERGENCY TIME…) from all emergency lighting ballasts in a DALI line and stores them in a structure of type ST_DALIV2DeviceSettingsType01.

Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. A check is first made as to whether a ballast is present at all. If this is the case, then the bPresent bit is set in the corresponding structure (see ST_DALIV2DeviceSettingsType01), after which the settings of the ballast are read out one by one and written in the associated variables in the structure. If it is found that a device is not available, the reading is skipped and work continues with the next device. The structure index here reflects the address of the device. In other words, data for the device with short address 0 is located at arrDALIDeviceSettingsType01[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettingsType01[63]. If a read error occurs when reading from a device, the corresponding bit in nErrors is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the reading of a variable from a ballast.

Bit | Error
0 | An error occurred whilst attempting to seek the ballast.
1 | Error whilst reading the variable BATTERY CHARGE
2 | Error whilst reading the variable DURATION TEST RESULT
3 | Error whilst reading the variable LAMP EMERGENCY TIME
4 | Error whilst reading the variable LAMP TOTAL OPERATION TIME
5 | Error whilst reading the variable EMERGENCY LEVEL
6 | Error whilst reading the variable EMERGENCY MIN LEVEL
7 | Error whilst reading the variable EMERGENCY MAX LEVEL
8 | Error whilst reading the variable RATED DURATION
9 | Error whilst reading the variable FUNCTION TEST DELAY TIME
10 | Error whilst reading the variable DURATION TEST DELAY TIME
11 | Error whilst reading the variable FUNCTION TEST INTERVAL
12 | Error whilst reading the variable DURATION TEST INTERVAL
13 | Error whilst reading the variable TEST EXECUTION TIMEOUT
14 | Error whilst reading the variable PROLONG TIME
15 | Error whilst reading the variable EMERGENCY MODE
16 | Error whilst reading the variable FEATURES
17 | Error whilst reading the variable FAILURE STATUS
18 | Error whilst reading the variable EMERGENCY STATUS

When the function block has been processed, the bBusy output changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many ballasts are attached.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
nOptions            : DWORD;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the reading of the variable.

eCommandPriority: Priority (high, medium or low) with which the command is processed by the library.

nOptions: Options for reading the variables (see table). The individual constants must be linked with OR operators.

Constant | Description
DALIV2_OPTION_BATTERY_CHARGE | The variable BATTERY CHARGE is read.
DALIV2_OPTION_DURATION_TEST_RESULT | The variable DURATION TEST RESULT is read.
DALIV2_OPTION_LAMP_EMERGENCY_TIME | The variable LAMP EMERGENCY TIME is read.
DALIV2_OPTION_LAMP_TOTAL_OPERATION_TIME | The variable LAMP TOTAL OPERATION TIME is read.
DALIV2_OPTION_EMERGENCY_LEVEL | The variable EMERGENCY LEVEL is read.
DALIV2_OPTION_EMERGENCY_MIN_LEVEL | The variable EMERGENCY MIN LEVEL is read.
DALIV2_OPTION_EMERGENCY_MAX_LEVEL | The variable EMERGENCY MAX LEVEL is read.
DALIV2_OPTION_RATED_DURATION | The variable RATED DURATION is read.
DALIV2_OPTION_NEXT_FUNCTION_TEST | The variable FUNCTION TEST DELAY TIME is read.
DALIV2_OPTION_NEXT_DURATION_TEST | The variable DURATION TEST DELAY TIME is read.
DALIV2_OPTION_FUNCTION_TEST_INTERVAL | The variable FUNCTION TEST INTERVAL is read.
DALIV2_OPTION_DURATION_TEST_INTERVAL | The variable DURATION TEST INTERVAL is read.
DALIV2_OPTION_TEST_EXECUTION_TIMEOUT | The variable TEST EXECUTION TIMEOUT is read.
DALIV2_OPTION_PROLONG_TIME | The variable PROLONG TIME is read.
DALIV2_OPTION_EMERGENCY_MODE | The variable EMERGENCY MODE is read.
DALIV2_OPTION_FEATURES | The variable FEATURES is read.
DALIV2_OPTION_FAILURE_STATUS | The variable FAILURE STATUS is read.
DALIV2_OPTION_EMERGENCY_STATUS | The variable EMERGENCY STATUS is read.
DALIV2_OPTION_ALL | All variables are read.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nCurrentShortAddr : BYTE;

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 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 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.

nCurrentShortAddr: Short address of the current ballast from which variables are being read.

VAR_IN_OUT

stCommandBuffer               : ST_DALIV2CommandBuffer;
arrDALIDeviceSettingsType01   : ARRAY [0..63] OF ST_DALIV2DeviceSettingsType01;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

arrDALIDeviceSettingsType01: Reference to an array of 64 elements of type ST_DALIV2DeviceSettingsType01. The settings of each individual DALI ballast are stored in these variables.


FB_DALIV2SetSettingsType01

This function-block initialises the variables (EMERGENCY LEVEL, FUNCTION TEST DELAY TIME, DURATION TEST DELAY TIME…) of all emergency lighting ballasts in a DALI line with the values that are stored in a structure of type ST_DALIV2DeviceSettingsType01.

Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. The system first checks whether the bPresent bit is set in the respective structure (see ST_DALIV2DeviceSettingsType01). If this is the case, all ballast variables that are not write-protected are initialised with the respective values of the structure. The structure index here reflects the address of the ballast. In other words, data for the device with short address 0 is located at arrDALIDeviceSettingsType01[0], and so on through to the ballast with short address 63 having its data at arrDALIDeviceSettingsType01[63]. If a write error occurs for a device, the nErrors element is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the writing of a variable to a ballast.

Bit | Error
5 | Error whilst writing the variable EMERGENCY LEVEL
9 | Error whilst writing the variable FUNCTION TEST DELAY TIME
10 | Error whilst writing the variable DURATION TEST DELAY TIME
11 | Error whilst writing the variable FUNCTION TEST INTERVAL
12 | Error whilst writing the variable DURATION TEST INTERVAL
13 | Error whilst writing the variable TEST EXECUTION TIMEOUT
14 | Error whilst writing the variable PROLONG TIME

When the function block has been processed, the bBusy output changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many ballasts are attached.

VAR_INPUT

bStart              : BOOL;
bCancel             : BOOL;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
nOptions            : DWORD;

bStart: The block is activated by a rising edge at this input.

bCancel: A rising edge at this input will deactivate the block and hence abort the reading of the variable.

eCommandPriority: Priority (high, medium or low) with which the command is processed by the library.

nOptions: Options for reading the variables (see table). The individual constants must be linked with OR operators.

Constant | Description
DALIV2_OPTION_EMERGENCY_LEVEL | The variable EMERGENCY LEVEL is initialised.
DALIV2_OPTION_NEXT_FUNCTION_TEST | The variable FUNCTION TEST DELAY TIME is initialised.
DALIV2_OPTION_NEXT_DURATION_TEST | The variable DURATION TEST DELAY TIME is initialised.
DALIV2_OPTION_FUNCTION_TEST_INTERVAL | The variable FUNCTION TEST INTERVAL is initialised.
DALIV2_OPTION_DURATION_TEST_INTERVAL | The variable DURATION TEST INTERVAL is initialised.
DALIV2_OPTION_TEST_EXECUTION_TIMEOUT | The variable TEST EXECUTION TIMEOUT is initialised.
DALIV2_OPTION_PROLONG_TIME | The variable PROLONG TIME is initialised.
DALIV2_OPTION_ALL | All variables are initialised.
DALIV2_OPTION_PUSH_DALI_COMMANDS | The buffer, which contains the feedback telegrams from the ballasts, among other things, is not read. Hence, writing becomes faster, but errors are not recognised.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nCurrentShortAddr : BYTE;

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 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 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.

nCurrentShortAddr: Short address of the ballast for which variables are being initialised.

VAR_IN_OUT

stCommandBuffer             : ST_DALIV2CommandBuffer;
arrDALIDeviceSettingsType01 : ARRAY [0..63] OF ST_DALIV2DeviceSettingsType01;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

arrDALIDeviceSettingsType01: Reference to an array of 64 elements of type ST_DALIV2DeviceSettingsType01. The settings of each individual DALI ballast are stored in these variables.


Emergency Lighting - Low-Level-Function Blocks

Name | Description
FB_DALIV2Inhibit | Prevents the ballast from switching to emergency mode for 15 minutes.
FB_DALIV2QueryBatteryCharge | The variable BATTERY CHARGE (state of battery charge) is read from the ballast.
FB_DALIV2QueryDurationTestResult | The variable DURATION TEST RESULT (result of duration test) is read from the ballast.
FB_DALIV2QueryEmergencyLevel | The variable EMERGENCY LEVEL (emergency illuminance) is read from the ballast.
FB_DALIV2QueryEmergencyMaxLevel | The variable EMERGENCY MAX LEVEL (maximum emergency illuminance) is read from the ballast.
FB_DALIV2QueryEmergencyMinLevel | The variable EMERGENCY MIN LEVEL (minimum emergency illuminance) is read from the ballast.
FB_DALIV2QueryEmergencyMode | The variable EMERGENCY MODE (emergency mode) is read from the ballast.
FB_DALIV2QueryEmergencyStatus | The variable EMERGENCY STATUS (status of emergency mode) is read from the ballast.
FB_DALIV2QueryFailureStatus | The variable FAILURE STATUS is read from the ballast.
FB_DALIV2QueryFeatures | The variable FEATURES (performance characteristics) is read from the ballast.
FB_DALIV2QueryLampEmergencyTime | The variable LAMP EMERGENCY TIME (emergency operation period of the lamp) is read from the ballast.
FB_DALIV2QueryLampTotalOperationTime | The variable LAMP TOTAL OPERATION TIME (total operation period of the lamp) is read from the ballast.
FB_DALIV2QueryRatedDuration | The variable RATED DURATION (rated operating period) is read from the ballast.
FB_DALIV2QueryTestTiming | Depending on the content of the DTR (data transfer register) the variables FUNCTION TEST DELAY TIME, DURATION TEST DELAY TIME, FUNCTION TEST INTERVAL, DURATION TEST INTERVAL, TEST EXECUTION TIMEOUT or PROLONG TIME are read from the ballast.
FB_DALIV2ReLightResetInhibit | The ballast is switched back to emergency mode (in the absence of mains voltage).
FB_DALIV2ResetDurationTestDoneFlag | The 'Duration test completed and result is valid' flag is reset.
FB_DALIV2ResetFunctionTestDoneFlag | The 'Function test completed and result is valid' flag is reset.
FB_DALIV2ResetLampTime | The LAMP EMERGENCY TIME and LAMP TOTAL OPERATION TIME variables are reset.
FB_DALIV2Rest | Switches the lamp off when emergency mode is active.
FB_DALIV2StartDurationTest | Starts the duration test.
FB_DALIV2StartFunctionTest | Starts the function test.
FB_DALIV2StopTest | Stops any type of function test or duration test.
FB_DALIV2StoreDTRAsDurationTestInterval | Writes the value of the DTR (data transfer register) into the variable DURATION TEST INTERVAL.
FB_DALIV2StoreDTRAsEmergencyLevel | Writes the value of the DTR (data transfer register) into the variable EMERGENCY LEVEL.
FB_DALIV2StoreDTRAsFunctionTestInterval | Writes the value of the DTR (data transfer register) into the variable FUNCTION TEST INTERVAL.
FB_DALIV2StoreDTRAsProlongTime | Writes the value of the DTR (data transfer register) into the variable PROLONG TIME.
FB_DALIV2StoreDTRAsTestDelayTimeHighByte | Writes the value of the DTR (data transfer register) into the high-order byte of variable TEST DELAY TIME.
FB_DALIV2StoreDTRAsTestDelayTimeLowByte | Writes the value of the DTR (data transfer register) into the low-order byte of variable TEST DELAY TIME.
FB_DALIV2StoreDTRAsTestExecutionTimeout | Writes the value of the DTR (data transfer register) into the variable TEST EXECUTION TIMEOUT.

Note: This function-block belongs to the application-extended commands for DALI-emergency-lighting devices. They are only working, if a special command called Enable Device Type 1 (FB_DALIV2EnableDeviceType()) was executed prior to this command. Beginnig with version 2.6.0 of both libraries TcDALIV2 and TcDALIV2AppExtCmds the command Enable Device Type 1 is automatically sent prior to all emergency-lighting-commands.


FB_DALIV2Inhibit

Prevents the ballast from switching to emergency mode for 15 minutes. The FB_DALIReLightResetInhibit() block can be used to deactivate suppression of emergency mode.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryBatteryCharge

The variable BATTERY CHARGE (state of battery charge) is read from the ballast. 255 is returned if the ballast is unable to determine the value.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nBatteryCharge   : BYTE;

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.

nBatteryCharge: Battery charge status. 0: empty / 254: full.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryDurationTestResult

The variable DURATION TEST RESULT (result of duration test) is read from the ballast. The unit is 2 minutes per step. 255 means a maximum value of 8.5 hours or more. The value is only valid if bit 2 is set in the variable EMERGENCY STATUS

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy               : BOOL;
bError              : BOOL;
nErrorId            : UDINT;
nDurationTestResult : BYTE;

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.

nDurationTestResult: The result of the duration test in steps of 2 minutes.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryEmergencyLevel

The variable EMERGENCY LEVEL (emergency illuminance) is read from the ballast. 255 is returned if the ballast is unable to determine the value.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
nErrorId        : UDINT;
nEmergencyLevel : BYTE;

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.

nEmergencyLevel: Emergency illuminance of the ballast.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryEmergencyMaxLevel

The variable EMERGENCY MAX LEVEL (maximum emergency illuminance) is read from the ballast. 255 is returned if the ballast is unable to determine the value.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy              : BOOL;
bError             : BOOL;
nErrorId           : UDINT;
nEmergencyMaxLevel : BYTE;

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.

nEmergencyMaxLevel: Emergency illuminance of the ballast.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryEmergencyMinLevel

The variable EMERGENCY MIN LEVEL (minimum emergency illuminance) is read from the ballast. 255 is returned if the ballast is unable to determine the value.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy              : BOOL;
bError             : BOOL;
nErrorId           : UDINT;
nEmergencyMinLevel : BYTE;

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.

nEmergencyMinLevel: Minimum emergency illuminance of the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryEmergencyMode

The variable EMERGENCY MODE is read from the ballast.

Bit | Description
0 | Reset mode. 0: No.
1 | Emergency mode readiness (normal operation). 0: No.
2 | Emergency mode. 0: No.
3 | Extended emergency mode once mains voltage is available again. 0: No.
4 | Function test active. 0: No.
5 | Duration test active. 0: No.
6 | Connected suppress push button is active. 0: Not active or not available.
7 | Connected mains voltage is active. 0: Off.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;
nEmergencyMode : BYTE;

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.

nEmergencyMode: Emergency mode (see table above).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryEmergencyStatus

The variable EMERGENCY STATUS (status of emergency mode) is read from the ballast.

Bit | Description
0 | Suppress mode. 0: No.
1 | Function test is completed and result is valid. 0: No.
2 | Duration test is completed and result is valid. 0: No.
3 | Battery charger ready for operation. 0: running.
4 | Start of function test delayed. 0: No.
5 | Start of duration test delayed. 0: No.
6 | Identification active. 0: No.
7 | Selected. 0: No

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nEmergencyStatus : BYTE;

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.

nEmergencyStatus: Status of emergency operation (see table above).

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryFailureStatus

The variable FAILURE STATUS is read from the ballast.

Bit | Description
0 | Fault in the ballast circuit. 0: No.
1 | Battery operation time fault. 0: No.
2 | Battery fault. 0: No.
3 | Emergency lamp fault. 0: No.
4 | Timeout during function test. 0: No.
5 | Timeout during duration test. 0: No.
6 | Function test failed. 0: No.
7 | Duration test failed. 0: No

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nFailureStatus   : BYTE;

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.

nFailureStatus: Controller failure status (see table above).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryFeatures

The variable FEATURES (performance characteristics) is read from the ballast.

Bit | Description
0 | Integrated emergency lighting supply unit. 0: No.
1 | Emergency lighting supply unit in continuous mode. 0: No.
2 | Switchable emergency lighting supply unit in continuous mode. 0: No.
3 | Auto test capability. 0: No.
4 | Adjustable emergency lighting illuminance. 0: No.
5 | Connected suppress push button is supported. 0: No.
6 | Physical selection is supported. 0: No.
7 | Reserved

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy         : BOOL;
bError        : BOOL;
nErrorId      : UDINT;
nFeatures     : BYTE;

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.

nFeatures: Features of the controller (see table above).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryLampEmergencyTime

The variable LAMP EMERGENCY TIME (emergency operation period of the lamp) is read from the ballast. The unit is 1 hour per step. 255 means a maximum value of 254 hours or more. The variable is always incremented at the start of the 1-hour interval. Once the maximum value of 255 is reached, it is not increased further. The variable is reset via the command FB_DALIV2ResetLampTime().

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy              : BOOL;
bError             : BOOL;
nErrorId           : UDINT;
nLampEmergencyTime : BYTE;

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.

nLampEmergencyTime: Emergency operation time of the lamp from the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryLampTotalOperationTime

The variable LAMP TOTAL OPERATION TIME is read from the ballast. The unit is 4 hours per step. 255 means a maximum value of 1016 hours or more. The variable is always incremented at the start of the 4-hour interval. Once the maximum value of 255 is reached, it is not increased further. The variable is reset via the command FB_DALIV2ResetLampTime().

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                   : BOOL;
bError                  : BOOL;
nErrorId                : UDINT;
nLampTotalOperationTime : BYTE;

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.

nLampTotalOperationTime: Total operating time of the lamp from the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryRatedDuration

The variable RATED DURATION (rated operating period) is read from the ballast. The unit is 2 minutes per step.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nRatedDuration   : BYTE;

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.

nRatedDuration: Rated operating time of the ballast.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryTestTiming

This function-block will read the test-specific times (intervals, durations, etc) out of the DALI-devices. Which value is read, depends on the input nDTR. The reason for using this additional input is, that two DALI-actions are required: Writing a parameter into the Data-Transfer-Register (DTR, command 257), which defines, which value is to be read and quering the desired test-time-value (command 242). The function-block FB_DALIV2QueryTestTiming will do both actions by itself.

nDTR | quered time-value
0 (2#0000 0000) | If automatic-test is activated: Time until the next Function-Test (high-byte) in quarters of an hour If automatic-test is not activated: MASK (255)
1 (2#0000 0001) | If automatic-test is activated: Time until the next Function-Test (low-byte) in quarters of an hour If automatic-test is not activated: MASK (255)
2 (2#0000 0010) | If automatic-test is activated: Time until the next Duration-Test (high-byte) in quarters of an hour If automatic-test is not activated: MASK (255)
3 (2#0000 0011) | If automatic-test is activated: Time until the next Duration-Test (low-byte) in quarters of an hour If automatic-test is not activated: MASK (255)
4 (2#0000 0100) | If automatic-test is activated: Function-Test interval-time in days If automatic-test is not activated: 0
5 (2#0000 0101) | If automatic-test is activated: Duration-Test interval-time in weeks If automatic-test is not activated: 0
6 (2#0000 0110) | Test-execution-timeout in days
7 (2#0000 0111) | Prolong-time in multiples of 0.5 min

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDTR              : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDTR: Depending on this input, the specific values will be read out of the device.

VAR_OUTPUT

bBusy       : BOOL;
bError      : BOOL;
nErrorId    : UDINT;
nValue      : BYTE;

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.

nValue: Read value.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ReLightResetInhibit

The ballast is switched back to emergency mode (in the absence of mains voltage). This deactivates the function of the FB_DALIV2Inhibit() block.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ResetDurationTestDoneFlag

The 'Duration test completed and result is valid' flag is reset. The flag is bit 2 of the variable EMERGENCY STATUS and can be queried with the FB_DALIQueryEmergencyStatus() block.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ResetFunctionTestDoneFlag

The 'Function test completed and result is valid' flag is reset. The flag is bit 1 of the variable EMERGENCY STATUS and can be queried with the FB_DALIQueryEmergencyStatus() block.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ResetLampTime

The LAMP EMERGENCY TIME and LAMP TOTAL OPERATION TIME variables are reset.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2Rest

This block switches the lamp off if emergency mode is active. Otherwise the system switches to normal operation if mains voltage is available again, or if the FB_DALIV2ReLightResetInhibit() block was called.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StartDurationTest

Starts the duration test. If the duration test is started with a delay, this is indicated in bit 5 of the EMERGENCY STATUS variable.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StartFunctionTest

Starts the function test. If the function test is started with a delay, this is indicated in bit 4 of the EMERGENCY STATUS variable.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StopTest

Stops any type of function test or duration test.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsDurationTestInterval

Writes the value of the DTR (data transfer register) into the variable DURATION TEST INTERVAL.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsEmergencyLevel

Writes the value of the DTR (data transfer register) into the variable EMERGENCY LEVEL (emergency illuminance).

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsFunctionTestInterval

Writes the value of the DTR (data transfer register) into the variable FUNCTION TEST INTERVAL.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsProlongTime

Writes the value of the DTR (data transfer register) into the variable PROLONG TIME.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsTestDelayTimeHighByte

Writes the value of the DTR (data transfer register) into the high-order byte of variable TEST DELAY TIME.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsTestDelayTimeLowByte

Writes the value of the DTR (data transfer register) into the low-order byte of variable TEST DELAY TIME.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StoreDTRAsTestExecutionTimeout

Writes the value of the DTR (data transfer register) into the variable TEST EXECUTION TIMEOUT (maximum execution time for a test).

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 1, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 1 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Discharge Lamps - Introduction

The function blocks and variables for discharge lamps with DALI interface are described below. All below function blocks described below call 'application-related expansion commands'. According to the DALI standard (IEC 62386) these commands are within the range 224 to 255. Because of the existence of a variety of application-related extension commands, it is necessary to use the FB_DALIV2EnableDeviceType() function block to specify which type of ballasts (emergency lighting, discharge lamps, ...) should react to the extension commands. A precise description of the individual DALI commands and the variables for discharge lamps with DALI interface will be found in Part 203 of the IEC 62386 standard.


Discharge Lamp - Variables

TwinCAT PLC Lib: DALI

Discharge Lamps - Variables

Every DALI ballast for discharge lamps has a certain number of variables (parameters ) from which it is possible to read a variety of information or to modify individual parameters.

Name | Default value | Reset value | Valid range | Size | Comment
HID STATUS | 0 | 0 | 0 ... 255 | 1 byte |
ACTUAL HID FAILURE | ???? ???? | No change | 0 ... 255 | 1 byte |
STORED HID FAILURE | ???? ???? | No change | 0 ... 255 | 1 byte |
HID FEATURES | Manufacturer-dependent | No change | 0 ... 255 | 1 byte | read only
THERMAL OVERLOAD TIME | 0 | No change | 00 00 ... FF FF | 2 bytes |
THERMAL LOAD | ???? ???? | No change | 0 ... 255 | 1 byte |
EXTENDED VERSION NUMBER | 1 | No change | 0 ... 255 | 1 byte | read only

?: Not specified

HID STATUS

The current status of the ballast is stored in HID STATUS. The value can be read with the FB_DALIV2QueryHIDStatus() block.

Bit | Description
0 | Start-up time, ready for operation. 0: No.
1 | The lamp power has reached its required set value. 0: No.
2 | Ballast is waiting for the lamp to ignite. 0: No.
3 | Reserved
4 | Reserved
5 | Reserved
6 | Identification active. 0: No.
7 | Reserved

ACTUAL HID FAILURE

This variable contains all the information about the fault status of the ballast. The variable is read with the FB_DALIV2QueryActualHIDFailure() block. Each of the relevant bits is set as soon as a fault occurs, and is automatically reset again as soon as the fault is rectified.
As long as either bit 4 or bit 7 is set, bit 1 in the STATUS INFORMATION variable will also be set. In that case, the FB_DALIV2QueryLampeFailure() block will return TRUE at the bLampFailure output.

Bit | Description
0 | Supply voltage too low. 0: No.
1 | Supply voltage too high. 0: No.
2 | Converter too hot. 0: No.
3 | Reserved
4 | Time for lamp ignition exceeded. 0: No.
5 | Reserved
6 | The lamp voltage outside specification. 0: No.
7 | Lamp cycle error. 0: No.

STORED HID FAILURE

This variable contains all the information about the fault status of the ballast. The variable is read with the FB_DALIV2QueryStoredHIDFailure() block. The error messages are reset by switching off the ballast, or by the FB_DALIV2ResetStoredHIDFailure() block.

Bit | Description
0 | Supply voltage too low. 0: No.
1 | Supply voltage too high. 0: No.
2 | Converter too hot. 0: No.
3 | Reserved
4 | Time for lamp ignition exceeded. 0: No.
5 | Reserved
6 | The lamp voltage outside specification. 0: No.
7 | Lamp cycle error. 0: No.

HID FEATURES

The performance characteristics supported by the ballast can be read from this variable via the FB_DALIV2QueryHIDFeatures() block. The content of this variable is specified by the manufacturer of the ballast and cannot be modified.

Bit | Description
0 | "Supply voltage too low" can be queried. 0: No.
1 | "Supply voltage too high" can be queried. 0: No.
2 | "Transformer too hot" can be queried. 0: No.
3 | Reserved
4 | Reserved
5 | Reserved
6 | "Lamp voltage outside specification" can be queried. 0: No.
7 | Physical selection is supported. 0: No.

THERMAL OVERLOAD TIME

As soon as excess temperature is detected, the variable THERMAL OVERLOAD TIME is incremented in steps of 15 minutes. This variable cannot be reset. Reaching 65535 (0xFFFF) here corresponds to a time of 16,383 hours and 45 minutes or more. The THERMAL OVERLOAD TIME variable can be read by the FB_DALIV2QueryThermalOverloadTimeHB() and FB_DALIV2QueryThermalOverloadTimeLB() blocks.
The threshold value for detecting excess temperature is specified by the THERMAL LOAD variable (see below).

THERMAL LOAD

A percentage value in the range between 0% and 127.5% is specified in steps of 0.5% in the THERMAL LOAD variable. 255 corresponds here to a value of 127.5%. The variable can be read with the FB_DALIV2QueryThermalLoad() block.

EXTENDED VERSION NUMBER

The extended version number can be read with the FB_QueryV2ExtendedVersionNumber() block. The version number can only be read, and is specified by the manufacturer of the ballasts.


Discharge Lamps - Function Blocks

Name | Description
FB_DALIV2QueryActualHIDFailure | The variable ACTUAL HID FAILURE (current error status) is read from the ballast.
FB_DALIV2QueryHIDFeatures | The variable HID FEATURES (performance characteristics) is read from the ballast.
FB_DALIV2QueryHIDStatus | The HID STATUS variable is read from the ballast.
FB_DALIV2QueryStoredHIDFailure | The STORED HID FAILURE (stored error status) variable is read from the ballast.
FB_DALIV2QueryThermalLoad | The THERMAL LOAD variable is read.
FB_DALIV2QueryThermalOverloadTime | The 16-bit variable THERMAL OVERLOAD TIME is read.
FB_DALIV2QueryThermalOverloadTimeHB | The high-order byte of the 16-bit variable THERMAL OVERLOAD TIME is read.
FB_DALIV2QueryThermalOverloadTimeLB | The low-order byte of the 16-bit variable THERMAL OVERLOAD TIME is read.
FB_DALIV2ResetStoredHIDFailure | The STORED HID FAILURE variable (stored lamp faults) is reset.

Note: This function-block belongs to the application-extended commands for DALI discharge devices. They are only working, if a special command called Enable Device Type 2 (FB_DALIV2EnableDeviceType()) was executed prior to this command. Beginnig with version 2.6.0 of both libraries TcDALIV2 and TcDALIV2AppExtCmds the command Enable Device Type 2 is automatically sent prior to all discharge-lighting-commands.


FB_DALIV2QueryActualHIDFailure

The variable ACTUAL HID FAILURE (current error status) is read from the ballast.

Bit | Description
0 | Supply voltage too low. 0: No.
1 | Supply voltage too high. 0: No.
2 | Converter too hot. 0: No.
3 | Reserved
4 | Time for lamp ignition exceeded. 0: No.
5 | Reserved
6 | The lamp voltage outside specification. 0: No.
7 | Lamp cycle error. 0: No.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nActualHIDFailure : BYTE;

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.

nActualHIDFailure: Content of the ACTUAL HID FAILURE variable.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryHIDFeatures

The variable HID FEATURES (performance characteristics) is read from the ballast.

Bit | Description
0 | "Supply voltage too low" can be queried. 0: No.
1 | "Supply voltage too high" can be queried. 0: No.
2 | "Transformer too hot" can be queried. 0: No.
3 | Reserved
4 | Reserved
5 | Reserved
6 | "Lamp voltage outside specification" can be queried. 0: No.
7 | Physical selection is supported. 0: No.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
nErrorId        : UDINT;
nHIDFeatures    : BYTE;

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.

nHIDFeatures: Content of the HID FEATURES variable.

VAR_IN_OUT

stCommandBuffer  : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryHIDStatus

The HID STATUS variable is read from the ballast.

Bit | Description
0 | Start-up time, ready for operation. 0: No.
1 | The lamp power has reached its required set value. 0: No.
2 | Ballast is waiting for the lamp to ignite. 0: No.
3 | Reserved
4 | Reserved
5 | Reserved
6 | Identification active. 0: No.
7 | Reserved

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy        : BOOL;
bError       : BOOL;
nErrorId     : UDINT;
nHIDStatus   : BYTE;

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.

nHIDStatus: Content of the HID STATUS variable.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryStoredHIDFailure

The STORED HID FAILURE (stored error status) variable is read from the ballast.

Bit | Description
0 | Supply voltage too low. 0: No.
1 | Supply voltage too high. 0: No.
2 | Converter too hot. 0: No.
3 | Reserved
4 | Time for lamp ignition exceeded. 0: No.
5 | Reserved
6 | The lamp voltage outside specification. 0: No.
7 | Lamp cycle error. 0: No.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nStoredHIDFailure : BYTE;

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.

nStoredHIDFailure: Content of the STORED HID FAILURE variable.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryThermalLoad

The THERMAL LOAD variable is read. This contains a percentage figure in the range from 0% to 127.5% in steps of 0.5%.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
nErrorId        : UDINT;
nThermalLoad    : BYTE;

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.

nThermalLoad: Content of the THERMAL LOAD variable.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryThermalOverloadTime

The value of the 16-bit variable THERMAL OVERLOAD TIME is read.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart             : BOOL;
nAddr              : BYTE;
eAddrType          : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority   : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                  : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;
nThermalOverloadTime   : WORD;

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.

nThermalOverloadTime: The value of the THERMAL OVERLOAD TIME variable.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryThermalOverloadTimeHB

The high-order byte of the 16-bit variable THERMAL OVERLOAD TIME is read.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                  : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;
nThermalOverloadTimeHB : BYTE;

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.

nThermalOverloadTimeHB: The high-order byte of the THERMAL OVERLOAD TIME variable.

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2QueryThermalOverloadTimeLB

The low-order byte of the 16-bit variable THERMAL OVERLOAD TIME is read.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                  : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;
nThermalOverloadTimeLB : BYTE;

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.

nThermalOverloadTimeLB: The low-order byte of the THERMAL OVERLOAD TIME variable.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2ResetStoredHIDFailure

The STORED HID FAILURE variable (stored lamp faults) is reset.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Colour/colour temperature control - Introduction

The function blocks and variables for lamps for colour/colour temperature control with DALI interface are described below. All below function blocks described below call 'application-related expansion commands'. According to the DALI standard (IEC 62386) these commands are within the range 224 to 255. Because of the existence of a variety of application-related extension commands, it is necessary to use the FB_DALIV2EnableDeviceType() function block to specify which type of ballasts (emergency lighting, discharge lamps, ...) should react to the extension commands. A precise description of the individual DALI commands and the variables for lamps for colour/colour temperature control with DALI interface can be found in IEC 62386 part 209.


Colour/colour temperature control - Variables

Every DALI ballast for colour/colour temperature control has a certain number of variables (parameters ) from which it is possible to read a variety of information or to modify individual parameters.

Certain variables can be read out directly via DALI commands (e.g. FB_QueryColourStatus() or FB_QueryRGBWAFControl ()). The FB_QueryColourValue() function block can be used to read out further variables.

Name | Default value | Reset value | Valid range | Size | necessary colour representation (1) | Comment
TEMPORARY x-COORDINATE | 65535 | 65535 | 0 ...65535 | 2 bytes | 0, 2 |
REPORT x-COORDINATE | 65535 | 65535 | 0 ... 65535 | 2 bytes | 0 |
x-COORDINATE | ? | No change | 0 ... 65535 | 2 bytes | 0 |
TEMPORARY x-COORDINATE | 65535 | 65535 | 0 ... 65535 | 2 bytes | 0, 2 |
REPORT x-COORDINATE | 65535 | 65535 | 0 ... 65535 | 2 bytes | 0 |
x-COORDINATE | ? | No change | 0 ... 65535 | 2 bytes | 0 |
TEMPORARY COLOUR TEMPERATURE Tc | 65535 | 65535 | 1 ... 65535 | 2 bytes | 1 |
REPORT COLOUR TEMPERATURE Tc | 65535 | 65535 | 1 ... 65535 | 2 bytes | 1 |
COLOUR TEMPERATURE Tc | ? | No change | 1 ... 65535 | 2 bytes | 1 |
COLOUR TEMPERATURE Tc COOLEST | ? | COLOUR TEMPERATURE Tc PHYSICAL COOLEST | COLOUR TEMPERATURE Tc PHYSICAL COOLEST ... COLOUR TEMPERATURE Tc WARMEST, 65535 | 2 bytes | 1 | read only
COLOUR TEMPERATURE Tc WARMEST | ? | COLOUR TEMPERATURE Tc PHYSICAL WARMEST | COLOUR TEMPERATURE Tc COOLEST ... COLOUR TEMPERATURE Tc PHYSICAL WARMEST, 65535 | 2 bytes | 1 | read only
COLOUR TEMPERATURE Tc PHYSICAL COOLEST | ? | No change | 1 - COLOUR TEMPERATURE Tc PHYSICAL WARMEST, 65535 | 2 bytes | 1 | read only
COLOUR TEMPERATURE Tc PHYSICAL WARMEST | ? | No change | COLOUR TEMPERATURE Tc PHYSICAL COOLEST - 65534, 65535 | 2 bytes | 1 | read only
TEMPORARY PRIMARY N DIMLEVEL | 65535 | 65535 | 0 ... 65535 | up to 12 bytes | 2 |
REPORT PRIMARY N DIMLEVEL | 65535 | 65535 | 0 ... 65535 | up to 12 bytes | 2 |
PRIMARY N DIMLEVEL | ? | No change | 0 ... 65535 | up to 12 bytes | 2 |
x-COORDINATE PRIMARY N | ? | No change | 0 ... 65535 | up to 12 bytes | 0, 2 | read only
y-COORDINATE PRIMARY N | ? | No change | 0 ... 65535 | up to 12 bytes | 0, 2 | read only
TY PRIMARY N | ? | No change | 0 ... 65535 | up to 12 bytes | 0, 2 | read only
TEMPORARY RED DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT RED DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
RED DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY GREEN DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT GREEN DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
GREEN DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY BLUE DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT BLUE DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
BLUE DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY WHITE DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT WHITE DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
WHITE DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY AMBER DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT AMBER DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
AMBER DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY FREECOLOUR DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT FREECOLOUR DIMLEVEL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
FREECOLOUR DIMLEVEL | ? | No change | 0 ... 255 | 1 byte | 3 |
TEMPORARY RGBWAF CONTROL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
REPORT RGBWAF CONTROL | 255 | 255 | 0 ... 255 | 1 byte | 3 |
RGBWAF CONTROL | 63 | No change | 0 ... 255 | 1 byte | 3 |
ASSIGNED COLOUR | 0x0102 0304 0506 | 0x0102 0304 0506 | 0x0000 0000 0000 ... 0x0606 0606 0606 | 6 bytes | 3 | read only MSB: Channel 0 LSB: Channel 5
TEMPORARY COLOUR TYPE | 255 | 255 | 0x10, 0x20, 0x40, 0x80, 0xFF | 1 byte | 0, 1, 2, 3 |
REPORT COLOUR TYPE | 255 | 255 | 0x10, 0x20, 0x40, 0x80, 0xFF | 1 byte | 0, 1, 2, 3 |
SCENE 0–15 COLOUR TYPE | 65535 | 65535 | 0x10, 0x20, 0x40, 0x80, 0xFF | 16 bytes | 0, 1, 2, 3 | read only
SCENE 0–15 COLOUR VALUE | 65535 | 65535 | 0 ... 65535 | 32 bytes ... 192 bytes | 0, 1, 2, 3 | read only
POWER ON COLOUR TYPE | Manufacturer-dependent | Manufacturer-dependent | 0x10, 0x20, 0x40, 0x80, 0xFF | 1 byte | 0, 1, 2, 3 | read only
POWER ON COLOUR VALUE | Manufacturer-dependent | Manufacturer-dependent | 0 ... 65535 | 2 bytes ... 12 bytes | 0, 1, 2, 3 | read only
SYSTEM FAILURE COLOUR TYPE | Manufacturer-dependent | Manufacturer-dependent | 0x10, 0x20, 0x40, 0x80, 0xFF | 1 byte | 0, 1, 2, 3 | read only
SYSTEM FAILURE COLOUR VALUE | Manufacturer-dependent | Manufacturer-dependent | 0 ... 65535 | 2 bytes ... 12 bytes | 0, 1, 2, 3 | read only
GEAR FEATURES/STATUS | ??00 0001b | ??00 0001b | ??00 0000b, ??00 0001b | 1 byte | 0, 1, 2, 3 |
COLOUR STATUS | ? | No change | 0 ... 255 | 1 byte | 0, 1, 2, 3 |
COLOUR TYPE FEATURES | ? | No change | 0 ... 255 | 1 byte | 0, 1, 2, 3 | read only

?: Not specified

In the case of 1-byte values the value 255 is also called MASK.

In the case of 2-byte values the value 65535 is also called MASK.

(1): Specifies the colour representation that the DALI ballast must support so that it contains the appropriate variable:

Value | Description
0 | xy coordinates
1 | Colour temperature Tc
2 | Primary (colour) N
3 | RGBWAF

ASSIGNED COLOUR

The assignment between output channel and colour is defined in ASSIGNED COLOUR. Each byte contains the colour of the corresponding channel.

The value can be read with the FB_DALIV2QueryAssignedColour() block.

Value | Description
0 | No colour assigned
1 | Red
2 | Green
3 | Blue
4 | White
5 | Amber
6 | Free colour

COLOUR TYPE

COLOUR TYPE defines the colour representations supported by the DALI ballast.

The values can be read out using the FB_DALIV2QueryColourValue() function block.

Value | Description
0x10 | xy coordinates
0x20 | Colour temperature Tc
0x40 | Primary (colour) N
0x80 | RGBWAF
0xFF | No colour change

COLOUR STATUS

COLOUR TYPE contains information about the current status of the DALI ballast.

The values can be read out using the FB_DALIV2QueryColourStatus() function block.

Bit | Description
0 | xy-coordinate colour point lies outside the valid range.
1 | Colour temperature Tc lies outside the valid range.
2 | Automatic calibration is active.
3 | Automatic calibration was successful.
4 | Colour representation xy-coordinate active.
5 | Colour representation colour temperature Tc active.
6 | Colour representation primary N active.
7 | Colour representation RGBWAF active.

GEAR FEATURES/STATUS

GEAR FEATURES/STATUS contains information about the current status of the DALI ballast.

The values can be read out using the FB_DALIV2QueryGearFeaturesStatus() function block and written using the FB_DALIV2StoreGearFeaturesStatus() function block.

Bit | Description
0 | Automatic activation.
1 - 5 | Reserved.
6 | Automatic calibration is supported.
7 | Restoration of the automatic calibration is supported.

RGBWAF CONTROL

RGBWAF CONTROL contains further information about the assignment between output channel and colour.

The values can be read out using the FB_DALIV2QueryColourValue() function block.

Bit | Description
0 | Output channel 0 / red
1 | Output channel 1 / green
2 | Output channel 2 / blue
3 | Output channel 3 / white
4 | Output channel 4 / amber
5 | Output channel 5 / free selectable colour
6 - 7 | 00 = channel control 01 = colour control 10 = standardised colour control 11 = reserved

COLOUR TYPE FEATURES

COLOUR TYPE FEATURES defines the colour representations supported by the DALI ballast.

The values can be read out using the FB_DALIV2QueryColourTypeFeatures() function block.

Bit | Description
0 | The ballast supports the colour representation by xy coordinates.
1 | The ballast supports the colour representation by colour temperature Tc.
2 - 4 | The number of primary colours supported by the ballast. A value of 0 means that this colour representation by primary colours is not supported.
5 - 7 | The number of RGBWAF channels supported by the ballast. A value of 0 means that this colour representation by RGBWAF is not supported.


Colour/colour temperature control - Function Blocks

Name | Description
FB_DALIV2Activate | Starts a new cross-fade. A running cross-fade will be ended beforehand.
FB_DALIV2AssignColourToLinkedChannel | Linked output channels are assigned to the defined colour.
FB_DALIV2ColourTemperatureTcStepCooler | The value COLOUR TEMPERATURE Tc is decremented by 1 Mirek.
FB_DALIV2ColourTemperatureTcStepWarmer | The value COLOUR TEMPERATURE Tc is incremented by 1 Mirek.
FB_DALIV2CopyReportToTemporary | The colour settings report is copied to the temporary colour settings.
FB_DALIV2QueryAssignedColour | Reads the assigned colour of the specified output channel.
FB_DALIV2QueryColourStatus | The COLOUR STATUS variable is read from the ballast.
FB_DALIV2QueryColourTypeFeatures | The colour representations supported by the ballast are read out.
FB_DALIV2QueryColourValue | The specified colour value is read from the ballast.
FB_DALIV2QueryGearFeaturesStatus | The GEAR FEATURES/STATUS variable is read from the ballast.
FB_DALIV2QueryRGBWAFControl | The RGBWAF CONTROL variable is read from the ballast.
FB_DALIV2SetTemporaryColourTemperatureTc | Saves the value in the TEMPORARY COLOUR TEMPERATURE Tc variable of the ballast.
FB_DALIV2SetTemporaryPrimaryNDimlevel | Saves the value in the TEMPORARY PRIMARY N DIMLEVEL variable of the ballast.
FB_DALIV2SetTemporaryRGBDimlevel | Saves the values in the TEMPORARY RED DIMLEVEL, TEMPORARY GREEN DIMLEVEL and TEMPORARY BLUE DIMLEVEL variables of the ballast.
FB_DALIV2SetTemporaryRGBWAFControl | Saves the value in the TEMPORARY RGBWAF CONTROL variable of the ballast.
FB_DALIV2SetTemporaryWAFDimlevel | Saves the values in the TEMPORARY WHITE DIMLEVEL, TEMPORARY AMBER DIMLEVEL and TEMPORARY FREECOLOUR DIMLEVEL variables of the ballast.
FB_DALIV2SetTemporaryXCoordinate | Saves the value in the TEMPORARY x-COORDINATE variable of the ballast.
FB_DALIV2SetTemporaryYCoordinate | Saves the value in the TEMPORARY y-COORDINATE variable of the ballast.
FB_DALIV2StartAutoCalibration | The calibration procedure is started in order to measure the x-coordinate, the y-coordinate and the TY value of all supported primary colours.
FB_DALIV2StoreColourTemperatureTcLimit | Saves the value in the COLOUR TEMPERATURE Tc COOLEST, COLOUR TEMPERATURE Tc WARMEST, COLOUR TEMPERATURE Tc PHYSICAL COOLEST or COLOUR TEMPERATURE Tc PHYSICAL WARMEST variable of the ballast.
FB_DALIV2StoreGearFeaturesStatus | Saves the value in the GEAR FEATURES/STATUS variable of the ballast.
FB_DALIV2StoreTYPrimaryN | Saves the value in the TY PRIMARY N variable of the ballast.
FB_DALIV2StoreXyCoordinatePrimaryN | Copies the value from the TEMPORARY x-COORDINATE and TEMPORARY y-COORDINATE variables to the x-COORDINATE PRIMARY N and y-COORDINATE PRIMARY N variables.
FB_DALIV2XCoordinateStepDown | The x-COORDINATE variable is reduced by 256 steps (256 / 65536) without cross-fading.
FB_DALIV2XCoordinateStepUp | The x-COORDINATE variable is increased by 256 steps (256 / 65536) without cross-fading.
FB_DALIV2YCoordinateStepDown | The y-COORDINATE variable is reduced by 256 steps (256 / 65536) without cross-fading.
FB_DALIV2YCoordinateStepUp | The y-COORDINATE variable is increased by 256 steps (256 / 65536) without cross-fading.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.


FB_DALIV2Activate

A current cross-fade is ended and a new cross-fade is started. Only the colour is changed here.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2AssignColourToLinkedChannel

Linked output channels are assigned to the defined colour (see table). The linked channels are specified by bit 0 to bit 5 of the TEMPORARY RGBWAF CONTROL variable. The channel assignment is not changed if TEMPORARY RGBWAF CONTROL contains the value 255 (MASK). All TEMPORARY COLOUR SETTINGS are set to MASK after the use of this command.

Value | Description
0 | No colour assigned
1 | Red
2 | Green
3 | Blue
4 | White
5 | Amber
6 | Free colour

The DTR (Data Transfer Register) of all DALI ballasts in the DALI line is changed by the function block.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nColour           : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nColour: Colour that is assigned to the output channels (see table).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2ColourTemperatureTcStepCooler

The COLOUR TEMPERATURE Tc value is decremented by 1 Mirek without cross-fading. If the COLOUR TEMPERATURE Tc value already has the same value as COLOUR TEMPERATURE Tc COOLEST, no change takes place.

Bit 1 (Colour temperature Tc out of range) is set in COLOUR STATUS if the colour temperature cannot be reached by the DALI ballast. This command is executed by the DALI ballast only if bit 5 (Colour type colour temperature Tc active) is set in the COLOUR STATUS variable.

The functions KELVIN_TO_MIREK and MIREK_TO_KELVIN are available for converting from or to Kelvin.

The block supports the following colour representations:

  • Colour temperature Tc

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2ColourTemperatureTcStepWarmer

The COLOUR TEMPERATURE Tc value is incremented by 1 Mirek without cross-fading. If the COLOUR TEMPERATURE Tc value already has the same value as COLOUR TEMPERATURE Tc WARMEST, no change takes place.

Bit 1 (Colour temperature Tc out of range) is set in COLOUR STATUS if the colour temperature cannot be reached by the DALI ballast. This command is executed by the DALI ballast only if bit 5 (Colour type colour temperature Tc active) is set in the COLOUR STATUS variable.

The functions KELVIN_TO_MIREK and MIREK_TO_KELVIN are available for converting from or to Kelvin.

The block supports the following colour representations:

  • Colour temperature Tc

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2CopyReportToTemporary

The colour settings report is copied to the temporary colour settings.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryAssignedColour

The ASSIGNED COLOUR variable is read from the DALI ballast. This contains the colour (see table) assigned to the specified output channel (0 - 5). 255 (MASK) is returned if a non-existent channel number is specified.

Value | Description
0 | No colour assigned
1 | Red
2 | Green
3 | Blue
4 | White
5 | Amber
6 | Free Colour

The DTR (Data Transfer Register) of all DALI ballasts in the DALI line is changed by the function block.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nChannel          : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nChannel: Channel (0 - 5).

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nAssignedColour  : BYTE;

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.

nAssignedColour: Assigned colour of the channel (see table).

VAR_IN_OUT

stCommandBuffer : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryColourStatus

The COLOUR STATUS variable is read from the DALI ballast.

Bit | Description
0 | xy-coordinate colour point lies outside the valid range.
1 | Colour temperature Tc lies outside the valid range.
2 | Automatic calibration is active.
3 | Automatic calibration was successful.
4 | Colour representation xy-coordinate active.
5 | Colour representation colour temperature Tc active.
6 | Colour representation primary N active.
7 | Colour representation RGBWAF active.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy            : BOOL;
bError           : BOOL;
nErrorId         : UDINT;
nColourStatus    : BYTE;

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.

nColourStatus: Colour status (see table above).

VAR_IN_OUT

stCommandBuffer : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryColourTypeFeatures

The COLOUR TYPE FEATURES variable is read from the DALI ballast. This contains the colour representations supported by the DALI ballast.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy                         : BOOL;
bError                        : BOOL;
nErrorId                      : UDINT;
bSupportsXyCoordinate         : BOOL;
bSupportsColourTemperatureTc  : BOOL;
nNumberOfPrimaryColors        : BYTE;
nNumberOfRGBWAFChannels       : BYTE;

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.

bSupportsXyCoordinate: The ballast is xy-coordinate-capable.

bSupportsColourTemperatureTc: The ballast is Colour temperature Tc-capable.

nNumberOfPrimaryColors: The number of primary colours supported by the ballast. A value of 0 means that this colour representation is not supported.

nNumberOfRGBWAFChannels: The number of RGBWAF channels supported by the ballast. A value of 0 means that this colour representation is not supported.

VAR_IN_OUT

stCommandBuffer     : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryColourValue

The specified variable (colour value) is read from the DALI ballast. The value to be read is defined by nParameter (see table below).

Certain variables can be read out directly via DALI commands (e.g. FB_QueryColourStatus() or FB_QueryRGBWAFControl ()). Further details on the variables can be found here.

Value | Description
0 | x-COORDINATE
1 | y-COORDINATE
2 | COLOUR TEMPERATURE Tc
3 | PRIMARY N DIMLEVEL 0
4 | PRIMARY N DIMLEVEL 1
5 | PRIMARY N DIMLEVEL 2
6 | PRIMARY N DIMLEVEL 3
7 | PRIMARY N DIMLEVEL 4
8 | PRIMARY N DIMLEVEL 5
9 | RED DIMLEVEL
10 | GREEN DIMLEVEL
11 | BLUE DIMLEVEL
12 | WHITE DIMLEVEL
13 | AMBER DIMLEVEL
14 | FREECOLOUR DIMLEVEL
15 | RGBWAF CONTROL
64 | x-COORDINATE PRIMARY N 0
65 | y-COORDINATE PRIMARY N 0
66 | TY PRIMARY N 0
67 | x-COORDINATE PRIMARY N 1
68 | y-COORDINATE PRIMARY N 1
69 | TY PRIMARY N 1
70 | x-COORDINATE PRIMARY N 2
71 | y-COORDINATE PRIMARY N 2
72 | TY PRIMARY N 2
73 | x-COORDINATE PRIMARY N 3
74 | y-COORDINATE PRIMARY N 3
75 | TY PRIMARY N 3
76 | x-COORDINATE PRIMARY N 4
77 | y-COORDINATE PRIMARY N 4
78 | TY PRIMARY N 4
79 | x-COORDINATE PRIMARY N 5
80 | y-COORDINATE PRIMARY N 5
81 | TY PRIMARY N 5
82 | NUMBER OF PRIMARIES
128 | COLOUR TEMPERATURE Tc COOLEST
129 | COLOUR TEMPERATURE Tc PHYSICAL COOLEST
130 | COLOUR TEMPERATURE Tc WARMEST
131 | COLOUR TEMPERATURE Tc PHYSICAL WARMEST
192 | TEMPORARY x-COORDINATE
193 | TEMPORARY y-COORDINATE
194 | TEMPORARY COLOUR TEMPERATURE Tc
195 | TEMPORARY PRIMARY N DIMLEVEL 0
196 | TEMPORARY PRIMARY N DIMLEVEL 1
197 | TEMPORARY PRIMARY N DIMLEVEL 2
198 | TEMPORARY PRIMARY N DIMLEVEL 3
199 | TEMPORARY PRIMARY N DIMLEVEL 4
200 | TEMPORARY PRIMARY N DIMLEVEL 5
201 | TEMPORARY RED DIMLEVEL
202 | TEMPORARY GREEN DIMLEVEL
203 | TEMPORARY BLUE DIMLEVEL
204 | TEMPORARY WHITE DIMLEVEL
205 | TEMPORARY AMBER DIMLEVEL
206 | TEMPORARY FREECOLOUR DIMLEVEL
207 | TEMPORARY RGBWAF CONTROL
208 | TEMPORARY COLOUR TYPE
224 | REPORT x-COORDINATE
225 | REPORT y-COORDINATE
226 | REPORT COLOUR TEMPERATURE Tc
227 | REPORT PRIMARY N DIMLEVEL 0
228 | REPORT PRIMARY N DIMLEVEL 1
229 | REPORT PRIMARY N DIMLEVEL 2
230 | REPORT PRIMARY N DIMLEVEL 3
231 | REPORT PRIMARY N DIMLEVEL 4
232 | REPORT PRIMARY N DIMLEVEL 5
233 | REPORT RED DIMLEVEL
234 | REPORT GREEN DIMLEVEL
235 | REPORT BLUE DIMLEVEL
236 | REPORT WHITE DIMLEVEL
237 | REPORT AMBER DIMLEVEL
238 | REPORT FREECOLOUR DIMLEVEL
239 | REPORT RGBWAF CONTROL
240 | REPORT COLOUR TYPE

Responses that concern an active colour representation are valid only if the colour representation of the requested colour value is active (see FB_DALIV2QueryColourStatus()) or if the ballast is capable or reconverting the demanded colour value from the active colour representation to a colour value of another colour representation.

The reply must be 255 (MASK) if the ballast does not know the coordinates or if the primary colour is not present.

The DTR (Data Transfer Register) and DTR1 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart           : BOOL;
nAddr            : BYTE;
eAddrType        : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nParameter       : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nParameter: Colour value to be read out (see table above).

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
nErrorId        : UDINT;
nValue          : UINT;

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.

nValue: Contains the value read out.

VAR_IN_OUT

stCommandBuffer : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryGearFeaturesStatus

The GEAR FEATURES/STATUS variable is read from the DALI ballast.

Bit | Description
0 | Automatic activation.
1 - 5 | reserved.
6 | Automatic calibration is supported.
7 | Restoration of the automatic calibration is supported.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart              : BOOL;
nAddr               : BYTE;
eAddrType           : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy               : BOOL;
bError              : BOOL;
nErrorId            : UDINT;
nGearFeaturesStatus : BYTE;

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.

nGearFeaturesStatus: Status information (see table above).

VAR_IN_OUT

stCommandBuffer     : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2QueryRGBWAFControl

The RGBWAF CONTROL variable is read from the DALI ballast.

Bit | Description
0 | Output channel 0 / red
1 | Output channel 1 / green
2 | Output channel 2 / blue
3 | Output channel 3 / white
4 | Output channel 4 / amber
5 | Output channel 5 / free selectable colour
6 - 7 | 00 = channel control 01 = colour control 10 = standardised colour control 11 = reserved

If an output channel or a colour is not supported, then the corresponding bit is FALSE.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
nErrorId          : UDINT;
nRGBWAFControl    : BYTE;

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.

nRGBWAFControl: Information about the channel assignment (see table above).

VAR_IN_OUT

stCommandBuffer   : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryColourTemperatureTc

Saves the value in the TEMPORARY COLOUR TEMPERATURE Tc variable of the DALI ballast. The value can be read out using the FB_DALIV2QueryColourValue () function block.

The value is expressed in units of 1 Mirek. A value of 0 is ignored and therefore not saved. The colour temperature Tc can vary from 1 Mirek (1000000 K) to 65534 Mirek (15.26 K).

The functions KELVIN_TO_MIREK and MIREK_TO_KELVIN are available for converting from or to Kelvin.

The DTR (Data Transfer Register) and DTR1 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • Colour temperature Tc

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nValue            : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nValue: The value that is written into the TEMPORARY COLOUR TEMPERATURE Tc variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryPrimaryNDimlevel

Saves the value in the TEMPORARY PRIMARY N DIMLEVEL variable of the ballast. The value can be read out using the FB_DALIV2QueryColourValue () function block.

The value is expressed in units of 1 / 65536. The maximum value of the PRIMARY N DIMLEVEL is 0.99997 and is interpreted on a linear scale.

The DTR (Data Transfer Register), DTR1 and DTR2 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • Primary (colour) N

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart              : BOOL;
nAddr               : BYTE;
eAddrType           : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nPrimaryColour      : BYTE;
nValue              : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nPrimaryColour: Primary colour (0 - 5).

nValue: The value that is written into the TEMPORARY PRIMARY N DIMLEVEL variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryRGBDimlevel

Saves the values in the TEMPORARY RED DIMLEVEL, TEMPORARY GREEN DIMLEVEL and TEMPORARY BLUE DIMLEVEL variables of the DALI ballast. The values can be read out using the FB_DALIV2QueryColourValue() function block.

The DTR (Data Transfer Register), DTR1 and DTR2 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart                  : BOOL;
nAddr                   : BYTE;
eAddrType               : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority        : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nTemporaryRedDimlevel   : BYTE;
nTemporaryGreenDimlevel : BYTE;
nTemporaryBlueDimlevel  : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nTemporaryRedDimlevel: The new value for TEMPORARY RED DIMLEVEL.

nTemporaryGreenDimlevel: The new value for TEMPORARY GREEN DIMLEVEL.

nTemporaryBlueDimlevel: The new value for TEMPORARY BLUE DIMLEVEL.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryRGBWAFControl

Saves the value in the TEMPORARY RGBWAF CONTROL variable of the DALI ballast. The value can be read out using the FB_DALIV2QueryColourValue () function block. The nTemporaryRGBWAFControl input thereby contains the new assignment (see table).

Bit | Description
0 | Output channel 0 / red
1 | Output channel 1 / green
2 | Output channel 2 / blue
3 | Output channel 3 / white
4 | Output channel 4 / amber
5 | Output channel 5 / free selectable colour
6 - 7 | 00 = channel control 01 = colour control 10 = standardised colour control 11 = reserved

The DTR (Data Transfer Register) of all DALI ballasts in the DALI line is changed by the function block.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart                   : BOOL;
nAddr                    : BYTE;
eAddrType                : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority         : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nTemporaryRGBWAFControl  : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nTemporaryRGBWAFControl: Contains the assignment (see table above).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryWAFDimlevel

Saves the values in the TEMPORARY WHITE DIMLEVEL, TEMPORARY AMBER DIMLEVEL and TEMPORARY FREECOLOUR DIMLEVEL variables of the DALI ballast. The values can be read out using the FB_DALIV2QueryColourValue() function block.

The DTR (Data Transfer Register), DTR1 and DTR2 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart                        : BOOL;
nAddr                         : BYTE;
eAddrType                     : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority              : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nTemporaryWhiteDimlevel       : BYTE;
nTemporaryAmberDimlevel       : BYTE;
nTemporaryFreecolourDimlevel  : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nTemporaryWhiteDimlevel: The new value for TEMPORARY WHITE DIMLEVEL.

nTemporaryAmberDimlevel: The new value for TEMPORARY AMBER DIMLEVEL.

nTemporaryFreecolourDimlevel: The new value for TEMPORARY FREECOLOUR DIMLEVEL.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryXCoordinate

Saves the value in the TEMPORARY x-COORDINATE variable of the DALI ballast. The value can be read out using the FB_DALIV2QueryColourValue () function block.

The DTR (Data Transfer Register) and DTR1 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • xy coordinates
  • Primary (colour) N

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nValue            : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nValue: The value that is written into the TEMPORARY x-COORDINATE variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2SetTemporaryYCoordinate

Saves the value in the TEMPORARY y-COORDINATE variable of the DALI ballast. The value can be read out using the FB_DALIV2QueryColourValue () function block.

The DTR (Data Transfer Register) and DTR1 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • xy coordinates
  • Primary (colour) N

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nValue            : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nValue: The value that is written into the TEMPORARY y-COORDINATE variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2StartAutoCalibrationl

TwinCAT PLC Lib: DALI

FB_DALIV2StartAutoCalibration

The calibration procedure is started in order to measure the x-coordinate, the y-coordinate and the TY value of all supported primary colours.

The command starts a 15-minute timer or initiates it again. Bit 2 of the COLOUR STATUS variable is 1 as long as the timer is active (see FB_DALIV2QueryColourStatus()). On expiry of the timer the last colour representation, the last colour value and the last lamp power level are directly saved again.

During the timer period the DALI ballast carries out a calibration procedure in order to measure the x-coordinate, the y-coordinate and the TY value of all supported primary colours. Whilst the calibration procedure is running, the DALI ballast does not react to any commands apart from TERMINATE, QUERY COLOUR STATUS and START AUTO CALIBRATION. In addition, bit 3 in the COLOUR STATUS variable is set to 0 at the start of the calibration. The TERMINATE command ends the procedure and stops the timer.

If the calibration was successful, bit 3 in COLOUR STATUS is set to 1 and the timer is stopped. If the calibration was not successful, then the last successful calibration data are restored if the DALI ballast is able to do so. Subsequently, bit 3 of COLOUR STATUS is set to 1. The ability to restore the last successful calibration data is a feature of the operating device (see QUERY GEAR FEATURES/STATUS command).

Due to the fact that the calibration can take longer than 15 minutes, the status of the automatic calibration should be checked periodically using the QUERY COLOUR STATUS command and the calibration timer restarted with the START AUTO CALIBRATION command (if necessary).

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2StoreColourTemperatureTcLimit

Saves the value in the COLOUR TEMPERATURE Tc COOLEST, COLOUR TEMPERATURE Tc WARMEST, COLOUR TEMPERATURE Tc PHYSICAL COOLEST or COLOUR TEMPERATURE Tc PHYSICAL WARMEST variable of the DALI ballast. The values can be read out using the FB_DALIV2QueryColourValue() function block. The nSelectLimitValue input defines the new limit value to be set:

Value | Limit value | Description
0 | COLOUR TEMPERATURE Tc COOLEST | lowest possible value, but always equal to or warmer than the lowest possible physical value.
1 | COLOUR TEMPERATURE Tc WARMEST | highest possible value, but always equal to or cooler than the highest possible physical value.
2 | COLOUR TEMPERATURE Tc PHYSICAL COOLEST | lowest possible physical value.
3 | COLOUR TEMPERATURE Tc PHYSICAL WARMEST | highest possible physical value.

The functions KELVIN_TO_MIREK and MIREK_TO_KELVIN are available for converting from or to Kelvin.

The DTR (Data Transfer Register), DTR1 and DTR2 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • Colour temperature Tc

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart              : BOOL;
nAddr               : BYTE;
eAddrType           : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority    : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nSelectLimitValue   : BYTE;
nValue              : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nSelectLimitValue: Specifies the new limit value to be set (see table above).

nValue: The value that is written into the selected variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2StoreGearFeaturesStatus

Saves the value in the GEAR FEATURES/STATUS variable of the DALI ballast. The values can be read out using the FB_DALIV2QueryGearFeaturesStatus() function block.

If bit 0 is set to 1, all commands for the control of the lamp power, with the exception of ENABLE DAPC SEQUENCE, must automatically trigger a colour transition.

Bit | Description
0 | Automatic activation.
1 - 7 | reserved.

The DTR (Data Transfer Register) of all DALI ballasts in the DALI line is changed by the function block.

The block supports the following colour representations:

  • xy coordinates
  • Colour temperature Tc
  • Primary (colour) N
  • RGBWAF

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart                : BOOL;
nAddr                 : BYTE;
eAddrType             : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority      : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nGearFeaturesStatus   : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nGearFeaturesStatus: Value that is written into the GEAR FEATURES/STATUS variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2StoreTYPrimaryN

Saves the value in the TY PRIMARY N variable of the DALI ballast.

The value is expressed in units of 0.5 lm, which results in a possible range of TYmin = 0 lm to TYmax = 32767 lm. A value of 65535 (MASK) means “unknown”. The nPrimaryColour parameter specifies the primary colour and must be within the range of 0 to 5, depending on the available number of primary colours. The command is ignored for every other value.

The DTR (Data Transfer Register), DTR1 and DTR2 of all DALI ballasts in the DALI line are changed by the function block.

The block supports the following colour representations:

  • Primary (colour) N

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nPrimaryColour    : BYTE;
nValue            : UINT;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nPrimaryColour: Primary colour (0 - 5).

nValue: The value that is written into the TY PRIMARY N variable.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2StoreXyCoordinatePrimaryN

Copies the value from the TEMPORARY x-COORDINATE and TEMPORARY y-COORDINATE variables to the x-COORDINATE PRIMARY N and y-COORDINATE PRIMARY N variables.

The nPrimaryColour parameter specifies the primary colour and must be within the range of 0 to 5, depending on the available number of primary colours. The command is ignored for every other value.

This command is intended to be used to save the current xy coordinates associated with the primary colour. xy coordinates outside the colour space chromaticity diagram are of no use and should therefore be avoided.

The DTR2 (Data Transfer Register) of all DALI ballasts in the DALI line is changed by the function block.

The block supports the following colour representations:

  • Primary (colour) N

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nPrimaryColour    : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nPrimaryColour: Primary colour (0 - 5).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2XCoordinateStepDown

The x-COORDINATE variable is reduced by 256 steps (256 / 65536) without cross-fading.

If the new colour value does not correspond to a colour that can be achieved by the DALI ballast, this must be indicated by bit 0 of COLOUR STATUS (xy-coordinate colour point lies outside the valid range). The command is executed only if bit 4 of COLOUR STATUS (colour representation xy-coordinate active) is set.

The block supports the following colour representations:

  • xy coordinates

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2XCoordinateStepUp

The x-COORDINATE variable is increased by 256 steps (256 / 65536) without cross-fading.

If the new colour value does not correspond to a colour that can be achieved by the DALI ballast, this must be indicated by bit 0 of COLOUR STATUS (xy-coordinate colour point lies outside the valid range). The command is executed only if bit 4 of COLOUR STATUS (colour representation xy-coordinate active) is set.

The block supports the following colour representations:

  • xy coordinates

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2YCoordinateStepDown

The y-COORDINATE variable is reduced by 256 steps (256 / 65536) without cross-fading.

If the new colour value does not correspond to a colour that can be achieved by the DALI ballast, this must be indicated by bit 0 of COLOUR STATUS (xy-coordinate colour point lies outside the valid range). The command is executed only if bit 4 of COLOUR STATUS (colour representation xy-coordinate active) is set.

The block supports the following colour representations:

  • xy coordinates

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


FB_DALIV2YCoordinateStepUp

The y-COORDINATE variable is increased by 256 steps (256 / 65536) without cross-fading.

If the new colour value does not correspond to a colour that can be achieved by the DALI ballast, this must be indicated by bit 0 of COLOUR STATUS (xy-coordinate colour point lies outside the valid range). The command is executed only if bit 4 of COLOUR STATUS (colour representation xy-coordinate active) is set.

The block supports the following colour representations:

  • xy coordinates

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 8, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 8 is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from Build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


KELVIN_TO_MIREK

Conversion of the colour temperature from Kelvin to Mirek.

Mirek is the unit that is used with most DALI commands. The return value is limited and lies within the range from 0 to 65535 (see table).

Mirek = 1,000,000 / (colour temperature in Kelvin).

Kelvin | Mirek
0 | 65535
15 | 65535
16 | 62500
1000 | 1000
10000 | 100
1000000 | 1
1000001 | 0

VAR_INPUT

fKelvin            : LREAL;

fKelvin: Colour temperature in Kelvin.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


MIREK_TO_KELVIN

Conversion of the colour temperature from Mirek to Kelvin.

Mirek is the unit that is used with most DALI commands. The return value is limited and lies within the range from approx. 15.259 to 1000001 (see table).

Mirek = 1,000,000 / (colour temperature in Kelvin).

Mirek | Kelvin
0 | 1000001
1 | 1000000
100 | 10000
1000 | 1000
10000 | 100
65534 | 15.259
65535 | 15.259

VAR_INPUT

nMirek            : UINT;

nMirek: Colour temperature in Mirek.

Development environment | Target system | Required libraries
TwinCAT 2.11 R3/x64 from build 2244 | PC/CX, BX or BC | TcDALIV2 library from V2.10.0


Philips proprietary Discharge Lamps - Introduction

The Philips company has defined its own DALI commands for special discharge lamps. These commands extend beyond the possible DALI commands in accordance with the standard IEC 62386 Part 203. However, these commands are only usable for certain Philips ballasts. Please contact Philips for a more detailed description of the commands.


Philips proprietary Discharge Lamps - Variables

Name | Default value | Reset value | Valid range | Size | Comment
PAEC_ENABLED | 0 | No change | 0 ... 1 | 1 Byte |
CONTROL GEAR SEGMENT ADDRESS | 0 | No change | 0 ... 255 | 1 Byte |
SEGMENT ADDRESS | 0 | 0 | 0 ... 255 | 1 Byte |
UIC | Manufacturer-dependent | No change | 00 00 00 00 00 00 00 00 ... FF FF FF FF FF FF FF FF | 8 Bytes | read only
LAMPTYPE | 0 | No change | 0 ... 255 | 1 Byte |
HID LAMP LEVEL | ???? ???? | 0 | 0 ... 255 | 1 Byte |
FADE UP | 0 | No change | 0 ... 255 | 1 Byte |
FADE DOWN | 0 | No change | 0 ... 255 | 1 Byte |
FAILURE STATUS | 0 | 0 | 0 ... 255 | 1 Byte |
OPERATION TIME | 0 | No change | 0 ... 255 | 1 Byte |
OVERTEMPERATURE TIME | 0 | No change | 0 ... 255 | 1 Byte |
CONTROL GEAR TEMPERATURE | 0 | 0 | 0 ... 255 | 1 Byte |
OVERTEMPERATURE LEVEL | 255 | No change | 0 ... 255 | 1 Byte |
TIMEOUT | 0 | No change | 0 ... 255 | 1 Byte |
MAINS VOLTAGE | 0 | 0 | 0 ... 255 | 1 Byte |
LAMP VOLTAGE | 0 | 0 | 0 ... 255 | 1 Byte |

?: Not specified


Philips proprietary Discharge Lamps - Function Blocks

Name | Description
FB_DALIV2PhilipsChangePAEC | Activates or deactivates the "Application Extended Command Set".
FB_DALIV2PhilipsQueryCtrlGearOperationTime | Reads the execution time of the ballast.
FB_DALIV2PhilipsQueryCtrlGearOvertempLevel | Reads the overtemperature threshold value of the ballast.
FB_DALIV2PhilipsQueryCtrlGearOvertempTime | Reads the overtemperature time of the ballast.
FB_DALIV2PhilipsQueryCtrlGearTemperature | Reads the temperature of the ballast.
FB_DALIV2PhilipsQueryFailureStatus | Reads the error status.
FB_DALIV2PhilipsQueryHIDLampLevel | Reads the lamp status.
FB_DALIV2PhilipsQueryHIDMaxFadeDownRate | Reads the maximum fade down rate.
FB_DALIV2PhilipsQueryHIDMaxFadeUpRate | Reads the maximum fade up rate.
FB_DALIV2PhilipsQueryLampType | Reads the lamp type.
FB_DALIV2PhilipsQueryLampVoltage | Reads the lamp voltage.
FB_DALIV2PhilipsQueryMainsVoltage | Reads the mains voltage.
FB_DALIV2PhilipsQueryTimeout | Reads the time-out.
FB_DALIV2PhilipsQueryUICByte | Reads a byte of the UIC.
FB_DALIV2PhilipsSetDTRAsSegmentAddress | Saves the data contained in the Data Transfer Register (DTR) to the Segment Address Register.
FB_DALIV2PhilipsSetTestMode | Sets the ballast to test mode.
FB_DALIV2PhilipsStoreDTRAsLampType | Saves the data in the Data Transfer Register (DTR) as lamp type.
FB_DALIV2PhilipsStoreDTRAsOvertempLevel | Saves the data in the Data Transfer Register (DTR) as overtemperature threshold value.
FB_DALIV2PhilipsStoreDTRAsSegmentAddress | Saves the data in the Data Transfer Register (DTR) as Segment Address Register.
FB_DALIV2PhilipsStoreDTRAsTimeout | Saves the data in the Data Transfer Register (DTR) as Time-out.

Hint: These commands are part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 2, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 2 is automatically preceded every application-specific extension commands for DALI devices internal.


Interior Automations proprietary PIR Sensor - Introduction

The company Interior Automation has defined proprietary DALI commands for PIR sensors. These commands exceed the possibilities of DALI commands of IEC 62386 standard. For a detailed command description please contact the company Interior Automation.


Interior Automations proprietary PIR Sensor - Function blocks

Name | Description
FB_DALIV2IAPIRPhysicalIndicatorOff | Deactivates the red LED.
FB_DALIV2IAPIRPhysicalIndicatorOn | Activates the red LED.
FB_DALIV2IAPIRQueryExtendedVersion | Reads the software version number.
FB_DALIV2IAPIRQueryFlags | Reads the properties.
FB_DALIV2IAPIRQuerySensitivity | Reads the sensor sensitivity.
FB_DALIV2IAPIRQueryTimeout | Reads the timeout.
FB_DALIV2IAPIRStartIdentification | Lets the green LED blink 10 seconds.
FB_DALIV2IAPIRStoreDTRAsFlags | Saves the data in the Data Transfer Register (DTR) as properties.
FB_DALIV2IAPIRStoreDTRAsSensitivity | Saves the data in the Data Transfer Register (DTR) as sensor sensitivity.
FB_DALIV2IAPIRStoreDTRAsTimeout | Saves the data in the Data Transfer Register (DTR) as timeout.

Hint: These commands are part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type 128, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type 128 is automatically preceded every application-specific extension commands for DALI devices internal.


FB_DALIV2QueryExtendedVersionNumber

The variable EXTENDED VERSION NUMBER is read from the ballast.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDeviceType       : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDeviceType: Identifier for the device type (see table at FB_DALIV2EnableDeviceType()).

VAR_OUTPUT

bBusy                  : BOOL;
bError                 : BOOL;
nErrorId               : UDINT;
nExtendedVersionNumber : BYTE;

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.

nExtendedVersionNumber: extended version number of the ballast.

VAR_IN_OUT

stCommandBuffer    : ST_DALIV2CommandBuffer;

stCommandBuffer: A reference to the structure for communication (the buffer) with the FB_DALIV2Communication() block.


FB_DALIV2StartIdentification

Starts a 10-second identification procedure of the ballast. The behaviour is specified by the manufacturer. The lamp usually is usually switched on and off according to a certain pattern.

Hint: This command is part of the application-specific extension command of DALI devices. They require the previous command Enable Device Type, which can be sent with the function block FB_DALIV2EnableDeviceType(). From library TcDALIV2 and TcDALIV2AppExtCmds version 2.6.0 the command Enable Device Type is automatically preceded every application-specific extension commands for DALI devices internal.

VAR_INPUT

bStart            : BOOL;
nAddr             : BYTE;
eAddrType         : E_DALIV2AddrType := eDALIV2AddrTypeShort;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nDeviceType       : BYTE;

bStart: The block is activated by a rising edge at this input.

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

eAddrType: Short address, group address or broadcast.

eCommandPriority: The priority (high, middle, low) this command has when executed by the library.

nDeviceType: Identifier for the device type (see table at FB_DALIV2EnableDeviceType()).

VAR_OUTPUT

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

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 (the buffer) with the FB_DALIV2Communication() block.


Error codes

Value (hex) | Value (dec) | Description
0x0000 | 0 | No error.
0x0001 | 1 | No answer from the DALI terminal.
0x0002 | 2 | No answer from the DALI ballast.
0x0003 | 3 | Communication buffer overflow.
0x0004 | 4 | No answer from the communication block.
0x0005 | 5 | DALI collision detected on the backward channel: During the transfer of a DALI telegram, a collision with the send data of another DALI slave was detected.
0x0006 | 6 | DALI collision detected on the forward channel: During the transfer of a DALI telegram, a collision with the send data of another DALI master was detected. The error also occurs when the 24V is missing on the power contacts of the KL6811.
0x0007 | 7 | When using the internal DALI power supply unit of the KL6811: overload of the internal DALI power supply unit of the KL6811 (bus under-voltage).
0x0008 | 8 | Parameter eCommandPriority is out of range.
0x0009 | 9 | Parameter eAddrType is out of range.
0x000A | 10 | Parameter nAddr is a short address and is out of range.
0x000B | 11 | Parameter nAddr is a group address and is out of range.
0x000C | 12 | Parameter nGroup is out of range.
0x000D | 13 | Parameter nScene is out of range.
0x000E | 14 | Parameter nStartWithShortAddress is out of range.
0x000F | 15 | no further free short addresses.
0x0010 | 16 | Parameter nNewShortAddress is out of range.
0x0011 | 17 | Parameter nNewShortAddress01 is out of range.
0x0012 | 18 | Parameter nShortAddress02 is out of range.
0x0013 | 19 | Parameter nFreeShortAddress is out of range.
0x0014 | 20 | The short address in parameter nFreeShortAddress is occupied within the DALI line.
0x0015 | 21 | Parameter arrSwapShortAddressList contains invalid values.
0x0016 | 22 | Parameter nHysteresis is out of range.
0x0017 | 23 | Parameter nProlongValue is not in the valid range.
0x0018 | 24 | Actual value of Master-Device is 255 for too long -> Device is possibly broken.
0x0019 | 25 | Parameter nEndLevel is not in the valid range.
0x001A | 26 | Target-value nEndLevel is not reached after twice the ramp-time.
0x001B | 27 | FB_DALIV2LightControl: One or more setpoint-values (nSetpoint) in the table arrControlTable are not in the valid DALI-Range (0..254).
0x001C | 28 | FB_DALIV2LightControl: The switch-range nSwitchRange of the 1st or 2nd element of the table arrControlTable is “0”. Thus it´s assumed, that the table has no or only one element.
0x001D | 29 | FB_DALIV2LightControl: At least one input-value nActualValue in the table arrControlTable lies in the switch range of its neighbour.
0x001E | 30 | FB_DALIV2LightControl: At least one setpoint (nSetpoint) in the table arrControlTable is not in the valid range. Will only be checked after starting with bStart.
0x001F | 31 | An internal state-query of the Master-Device tells, that the state "fading active" is set for too long after the expected end of the dimming. See also STATUS INFORMATION (Bit 4).
0x0020 | 32 | Parameter nPresenceValue is not in the valid range.
0x0021 | 33 | Timeout during internal addressing (see also FB_DALIV2AddressingIntRandomAddressing()). The terminal has not sent a reply following the start of internal addressing.
0x0022 | 34 | The terminal has returned an error during internal addressing (see also FB_DALIV2AddressingIntRandomAddressing()).
0x0023 | 35 | At least one test is still pending or active.
0x0024 | 36 | Device in automatic-test-mode.
0x0025 | 37 | Battery not fully charged for duration-test.
0x0026 | 38 | Test canceled, no valid emergency-Status/Mode during test.
0x0027 | 39 | Test canceled Test-mode not reached.
0x0028 | 40 | Test canceled because of timeout.
0x0029 | 41 | Error executing DALI-command.
0x002A | 42 | Error writing into log-file.
0x002B | 43 | Device not in 'normal-mode'.
0x002C | 44 | FB_DALIV2Sequencer: The start-index nStartIndex is not within the valid range [1..50].
0x002D | 45 | FB_DALIV2Sequencer: The start-index nStartIndex points to an entry, which is marked as a sequence-end (zero-entry).
0x002E | 45 | FB_DALIV2ChangeAddressList: The change-list arrChangeAddressList is empty.
0x002F | 46 | FB_DALIV2ChangeAddressList: The change-list arrChangeAddressList contains an invalid short-addresses.
0x0030 | 47 | FB_DALIV2ChangeAddressList: The change-list arrChangeAddressList contains an double-entry regarding either the new or the old short-addresses.
0x0031 | 48 | FB_DALIV2ChangeAddressList: The change-list arrChangeAddressList containes an new-address which is already used by a device not affected by the changes in the DALI-LINE Adresses are re-programmed.


E_DALIV2AddrType

TYPE E_DALIV2AddrType :
(
    eDALIV2AddrTypeShort      := 0,
    eDALIV2AddrTypeGroup      := 1,
    eDALIV2AddrTypeBroadcast  := 2
);
END_TYPE


E_DALIV2CommandPriority

TYPE E_DALIV2CommandPriority :
(
    eDALIV2CommandPriorityHigh    := 0,
    eDALIV2CommandPriorityMiddle  := 1,
    eDALIV2CommandPriorityLow     := 2
);
END_TYPE


E_DALIV2CurrentAddressingState

TYPE E_DALIV2CurrentAddressingState :
(
    eDALIV2AddrStateIdle           := 0,
    eDALIV2AddrStateRemoveLamp     := 1,
    eDALIV2AddrStateReinsertLamp   := 2,
    eDALIV2AddrStateAddressingLamp := 3
);
END_TYPE


ST_DALIV2ChangeAddressList

STRUCT
    nOldAddress           : BYTE;
    nNewAddress           : BYTE;
    nRandomAddressHigh    : BYTE;
    nRandomAddressMiddle  : BYTE;
    nRandomAddressLow     : BYTE;
    nErrors               : DWORD;
END_STRUCT


ST_DALIV2ControlTable

STRUCT
    nActualValue    : UINT;
    nControlValue   : BYTE;
    nSwitchRange    : UINT;
END_STRUCT

nActualValue: Measured light value.

nControlValue: Control value of a node. Valid range: 0 or nMinLevelMasterDev ... nMaxLevelMasterDev.

nSwitchRange: Switching range around the node. nSwitchRange can only be "0" for the first node of the unused table-range.


ST_DALIV2DeviceSettings

STRUCT
    nErrors              : DWORD;
    bPresent             : BOOL;
    nActualLevel         : BYTE;
    nPowerOnLevel        : BYTE;
    nSystemFailureLevel  : BYTE;
    nMinLevel            : BYTE;
    nMaxLevel            : BYTE;
    nFadeRate            : BYTE;
    nFadeTime            : BYTE;
    nRandomAddress       : DWORD;
    nGroups              : WORD;
    nSceneLevels         : ARRAY [0..15] OF BYTE;
    nStatus              : BYTE;
    nMajorVersion        : BYTE;
    nMinorVersion        : BYTE;
    nDeviceType          : BYTE;
    nPhysicalMinLevel    : BYTE;
END_STRUCT


ST_DALIV2DeviceSettingsType01

STRUCT
    nErrors                     : DWORD;
    bPresent                    : BOOL;
    nBatteryCharge              : UINT;    (*0..254, 255->Error*)
    tDurationTestResult         : TIME;    (*0..510 min*)
    tLampEmergencyTime          : TIME;    (*0..255 h*)
    tLampTotalOperationTime     : TIME;    (*0..1024 h*)
    nEmergencyLevel             : BYTE;    (*0..254*)
    nEmergencyMinLevel          : BYTE;    (*0..254*)
    nEmergencyMaxLevel          : BYTE;    (*0..254*)
    tRatedDuration              : TIME;    (*0..510 min*)
    nNextFunctionTest           : UINT;    (*0..255*)
    nNextDurationTest           : UINT;    (*0..255*)
    nFunctionTestInterval       : UINT;    (*0..255*)
    nDurationTestInterval       : UINT;    (*0..255*)
    nTestExecutionTimeout       : UINT;    (*0..255*)
    nProlongTime                : UINT;    (*0..255*)
    nEmergencyMode              : BYTE;
    nFeatures                   : BYTE;
    nFailureStatus              : BYTE;
    nEmergencyStatus            : BYTE;
END_STRUCT

Note: The following variables undergo an adjustment to their target display range when read, hence deviating from the read display of the DALI device:
tDurationTestResult : TIME; (*0..510 min*)
tLampEmergencyTime : TIME; (*0..255 h*)
tLampTotalOperationTime : TIME; (*0..1024 h*)
tRatedDuration : TIME; (*0..510 min*)

In the case of the remaining variables, the conversion either does not make sense (e.g. nEmergencyLevel) or display is not possible, as for example in the case of nNextDurationTest, since the range of the variable of type TIME is insufficient.


ST_DALIV2InData

STRUCT
    nStatus  : BYTE;
    nDummy   : BYTE;
    nData    : WORD;
END_STRUCT


ST_DALIV2OutData

STRUCT
    nCtrl   : BYTE;
    nDummy  : BYTE;
    nData   : WORD;
END_STRUCT


ST_DALIV2SequenceTable

STRUCT
    nTargetValue        : BYTE;
    tRampTime           : TIME;
    tProlongTime        : TIME;
END_STRUCT

nTargetValue: Target-value.

tRampTime: Time to reach the target-value.

tProlongTime: Time to stay on the target-value.


ST_DALIV2SwapShortAddressList

STRUCT
    bShortAddressValid    : BOOL;
    nNewShortAddress      : BYTE;
END_STRUCT