FB_DALI102SendCommand

FB_DALI102SendCommand 1:

The FB_DALI102SendCommand function block sends the specified DALI command to the DALI control gear.

An additional parameter can be transferred for certain DALI commands via the nParameter input. The exact meaning of the parameter is defined in the DALI standard. These DALI commands are identified in the nParameter column in the table below.

The return value for the query commands is output at the nResponse output. The exact meaning of the parameter is defined in the DALI standard. These DALI commands are identified in the nResponse column in the table below.

Some DALI commands are sent twice, as required by the DALI standard for certain DALI commands. These DALI commands are identified in the send twice column in the table below.

If several instances of FB_DALI102SendCommand send DALI commands via the same DALI terminal, the DALI commands of the individual instances are not synchronized with each other. This can lead to undesirable behavior, for example, if parameters in DALI control gears are changed.

In most cases, several DALI commands must be sent to change a parameter. Among other things, the DALI command must also be used to set the DTR. As the DALI command for setting the DTR is always sent as a broadcast command, this has an effect on all DALI control gears in a DALI line. If several instances of FB_DALI102SendCommand change the parameters of DALI control gears on a DALI line at the same time, this can lead to undesirable side effects.

FB_DALI102SendCommand 2:

This means that only one instance of FB_DALI102SendCommand should be created per DALI line. The DALI commands must then be synchronized in the application that accesses FB_DALI102SendCommand.

FB_DALI102SendCommand 3: Inputs

VAR_INPUT
  bStart            : BOOL;
  nAddress          : BYTE;
  eAddressType      : E_DALIAddressType := E_DALIAddressType.Short;
  eCommandPriority  : E_DALICommandPriority := E_DALICommandPriority.MiddleLow;
  nCommand          : INT;
  nParameter        : USINT;
END_VAR

Name

Type

Description

bStart

BOOL

Execution of the DALI commands is triggered via a positive edge at this input.

nAddress

BYTE

Address of a DALI control gear or a DALI group.

eAddressType

E_DALIAddressType

Defines whether the input nAddress contains a short address (0…63) or a group address (0…15). The input nAddress has no meaning if a broadcast or a broadcast to unaddressed devices (BroadcastUnaddr) has been selected.

eCommandPriority

E_DALICommandPriority

Priority (low, middle low, middle, middle high, high) with which the DALI commands are sent.

FB_DALI102SendCommand 4:

eCommandPriority has no function with the KL6811. The DALI command priorities are supported by the KL6821 from the firmware version BD.

Name

Type

Description

nCommand

INT

DALI command to be sent.
Possible DALI commands are listed in the table below.

nParameter

USINT

Additional parameter of a DALI command. Commands with additional parameters are listed in the table below.

FB_DALI102SendCommand 5: Outputs

VAR_OUTPUT
  bError                  : BOOL;
  ipResultMessage         : I_TcMessage;
  bBusy                   : BOOL;
  nResponse               : BYTE;
END_VAR

Name

Type

Description

bError

BOOL

This output is switched to TRUE if an error occurs during the execution. Further information about the error can be queried via the variable ipResultMessage. The output is set to FALSE again as soon as bBusy switches to TRUE.

ipResultMessage

I_TcMessage

Interface pointer (see error evaluation) that can be used to obtain detailed information about the processing of the function block (see runtime messages). The interface pointer is valid after bBusy has changed from TRUE to FALSE.

bBusy

BOOL

The output is set as soon as execution of the DALI commands has commenced. It remains active until all DALI commands have been processed.

nResponse

BYTE

Return value of the query command. The table below shows the commands with potential return values.

Commands

nCommand

DALI command

nParameter

nResponse

Send twice

-1

DAPC

+

-

-

0

OFF

-

-

-

1

UP

-

-

-

2

DOWN

-

-

-

3

STEP UP

-

-

-

4

STEP DOWN

-

-

-

5

RECALL MAX LEVEL

-

-

-

6

RECALL MIN LEVEL

-

-

-

7

STEP DOWN AND OFF

-

-

-

8

ON AND STEP UP

-

-

-

9

ENABLE DAPC SEQUENCE

-

-

-

10

GO TO LAST ACTIVE LEVEL

-

-

-

11

CONTINUOUS UP

-

-

-

12

CONTINUOUS DOWN

-

-

-

16…31

GO TO SCENE

-

-

-

32

RESET

-

-

+

33

STORE ACTUAL LEVEL IN DTR0

-

-

+

35

SET OPERATING MODE

-

-

+

36

RESET MEMORY BANK

-

-

+

37

IDENTIFY DEVICE

-

-

+

42

SET MAX LEVEL

-

-

+

43

SET MIN LEVEL

-

-

+

44

SET SYSTEM FAILURE LEVEL

-

-

+

45

SET POWER ON LEVEL

-

-

+

46

SET FADE TIME

-

-

+

47

SET FADE RATE

-

-

+

48

SET EXTENDED FADE TIME

-

-

+

64…79

SET SCENE

-

-

+

80…95

REMOVE FROM SCENE

-

-

+

96…111

ADD TO GROUP

-

-

+

112…127

REMOVE FROM GROUP

-

-

+

128

SET SHORT ADDRESS

-

-

+

129

ENABLE WRITE MEMORY

-

-

+

144

QUERY STATUS

-

+

-

145

QUERY CONTROL GEAR PRESENT

-

+

-

146

QUERY LAMP FAILURE

-

+

-

147

QUERY LAMP POWER ON

-

+

-

148

QUERY LIMIT ERROR

-

+

-

149

QUERY RESET STATE

-

+

-

150

QUERY MISSING SHORT ADDRESS

-

+

-

151

QUERY VERSION NUMBER

-

+

-

152

QUERY CONTENT DTR0

-

+

-

153

QUERY DEVICE TYPE

-

+

-

154

QUERY PHYSICAL MINIMUM

-

+

-

155

QUERY POWER FAILURE

-

+

-

156

QUERY CONTENT DTR1

-

+

-

157

QUERY CONTENT DTR2

-

+

-

158

QUERY OPERATING MODE

-

+

-

159

QUERY LIGHT SOURCE TYPE

-

+

-

160

QUERY ACTUAL LEVEL

-

+

-

161

QUERY MAX LEVEL

-

+

-

162

QUERY MIN LEVEL

-

+

-

163

QUERY POWER ON LEVEL

-

+

-

164

QUERY SYSTEM FAILURE LEVEL

-

+

-

165

QUERY FADE TIME/FADE RATE

-

+

-

166

QUERY MANUFACTURER SPECIFIC MODE

-

+

-

167

QUERY NEXT DEVICE TYPE

-

+

-

168

QUERY EXTENDED FADE TIME

-

+

-

170

QUERY CONTROL GEAR FAILURE

-

+

-

176…191

QUERY SCENE LEVEL

-

+

-

192

QUERY GROUPS 0-7

-

+

-

193

QUERY GROUPS 8-15

-

+

-

194

QUERY RANDOM ADDRESS H

-

+

-

195

QUERY RANDOM ADDRESS M

-

+

-

196

QUERY RANDOM ADDRESS L

-

+

-

197

READ MEMORY LOCATION

-

+

-

255

QUERY EXTENDED VERSION NUMBER

-

+

-

256

TERMINATE

-

-

-

257

DTR0

+

-

-

258

INITIALISE

+

-

+

259

RANDOMISE

-

-

+

260

COMPARE

-

+

-

261

WITHDRAW

-

-

-

264

SEARCHADDR H

+

-

-

265

SEARCHADDR M

+

-

-

266

SEARCHADDR L

+

-

-

267

PROGRAM SHORT ADDRESS

+

-

-

268

VERIFY SHORT ADDRESS

+

+

-

269

QUERY SHORT ADDRESS

-

+

-

272

ENABLE DEVICE TYPE

+

-

-

273

DTR1

+

-

-

274

DTR2

+

-

-

275

WRITE MEMORY LOCATION

+

+

-

276

WRITE MEMORY LOCATION - NO REPLY

+

+

-

Prerequisites

Development environment

Required PLC library

TwinCAT from v3.1.4024.68

Tc3_DALI from v3.22.2.0