Home  > blog  > 

Realization of Automatic Address Assignment in DALI Protocol

Realization of Automatic Address Assignment in DALI Protocol


The new standard of DALI protocol (Digital Addressable Lighting Interface) defines the digital communication between electronic ballasts and control units. DALI is not designed for complex bus systems, but for indoor use. Intelligent, high-performance lighting management, focusing on the static effect of lighting, these functions can of course be integrated into the building management system through a suitable interface. To


In order to ensure complete compatibility between the DALI components of various manufacturers, the DALI protocol has been standardized worldwide and compiled into the IEC60929 ballast standard. Part E of the standard clearly describes the electrical characteristics and protocols of DALI. This establishes the basis for the sales and use of DALI components all over the world, regardless of manufacturer, country or technical incompatibility. World-renowned companies support this standard.


In the DALI protocol, the most complicated part is the process of the host automatically assigning addresses to the DALI device, which is also the difficulty in designing the DALI master controller. The DALI main control I design now uses 32-bit LPC2292 CPU, with independent 2 DALI bus loops, while using CAN bus to connect with other systems, the entire main controller realizes the management of two DALI bus devices, including address allocation, grouping, Scene setting, schedule, timing control and other functions. As long as the realization of the DALI automatic address allocation process is discussed below:


Address allocation is divided into three situations:


1. All devices re-allocate addresses. This situation is generally used during the first engineering commissioning;

2. Extend the assigned address, only assign addresses to devices that have not been assigned addresses, and use them when new devices are added to the project;

3. Repeated address allocation. When two devices with the same address are found, it is necessary to re-allocate addresses for these two devices.


The difference between the three cases is that when the address allocation protocol is initialized, use


Command 258: 1010 0101 XXXX XXXX "INITIALISE" to distinguish, when:


XXXX XXXX = 0000 0000 Reallocate addresses for all devices;


XXXX XXXX = 1111 1111 extended allocation address;


XXXX XXXX = 0AAA AAA1 Redistribution of duplicate addresses, where AAAAAA is the specified duplicate address


Here we need to mention the principle of DALI automatic address allocation: (DALI devices produced by different manufacturers must conform to the DALI standard protocol, and all devices must be connected to the same bus.) After the previous initialization command, the main controller needs to send random Number generation command RANDOMISE. At this time, the initialized device will generate a 24-bit random number. Of course, the random number generated by each device must not be the same, and it cannot be equal to 0 and FFFFFF. This is also a technical problem. discuss. After the device generates a random number, the host starts to send a 24-bit data of its own and compares it with the device on the bus, and finds the device with the smallest random number. At this time, the device is assigned a minimum address that is not assigned, and the address is successfully assigned to the device. After the device, send another exit command, the device with the assigned address exits the initialization state and no longer responds to the comparison command of the host. Repeat the above process until all DALI devices are found.


The commands used in the address allocation process are:


258 1010 0101 XXXX XXXX INITIALISE (initialization)

259 1010 0111 0000 0000 RANDOMISE (generate random number)

260 1010 1001 0000 0000 COMPARE (compare the size of host data and random number)

261 1010 1011 0000 0000 WITHDRAW (Exit compare command)

264 1011 0001 HHHH HHHH SEARCHADDRH (host data high byte)

265 1011 0011 MMMM MMMM SEARCHADDRM (Mid section of host data)

266 1011 0101 LLLL LLLL SEARCHADDRL (Host data low section)

267 1011 0111 0AAA AAA1 PROGRAM SHORT ADDRESS (programming address)

268 1011 1001 0AAA AAA1 VERIFY SHORT ADDRESS (check address)


From the above address allocation principle, it can be seen that in this allocation process, the only problem is the comparison between the host's 24-bit data and the 24 random number of the DALI device. How to find the device with the smallest random number? Solving this problem is the key. There are many ways to compare the size of the two data. I only need to use the 2-point algorithm here. The implementation steps are as follows:


1. The host sends FFFFFF to compare with the DALI device, because the random generated by the DALI device is definitely smaller than FFFFFF. If there is a device on the bus that has no address assigned, the answer is yes. Otherwise NO.


2. After knowing whether there are devices with addresses allocated on the bus in the previous step, use the 2-point algorithm to compare host data and random numbers. The number of divisions is 8,4,2,1.,0. The three-byte data is divided into 6 nibbles according to the nibble. From the highest nibble, assuming the value Y=8 at the beginning, If there is a DALI device that answers YES, the current value is subtracted from the next number of the number of 2 points and modified to Y=Y-4. If there is a DALI device that answers NO, the current value is added to the number of 2 points. For the next number, modify Y=Y+4 until the value of the number is less than 1 in the 2-point method.

Such as: compare the highest nibble:

Data to be compared DALI device answer 2 points to modify the nibble value

80 00 00 YES YES 8-4=4

40 00 00 YES YES 4-2=2

20 00 00 NO NO 2+1=3

30 00 00 NO NO The number is less than 1, and the comparison of this nibble is completed. The value of this nibble is 3, and then the next nibble is compared.

38 00 00 NO NO 8+4=C

3C 00 00 NO NO C+2=E

3E 00 00 YES YES E-1=D

3D 00 00 NO NO The number is less than 1, and the comparison of this nibble is completed. Here, the value of the nibble is D, and then the next nibble is compared.


The highest byte comparison is complete, then use the same method to compare the middle byte and the low byte.

In this way, the device with the smallest random number can be found.


3. After finding the device with the smallest random number, use the PROGRAM SHORT ADDRESS command to assign an address to this device.

4. After the address assignment is completed, use the WITHDRAW exit command to make the device with the assigned address exit the comparison command.

5. Repeat the above steps to compare and find other DALI devices. Until sending FFFFFF, no device answers YES.


I use the above method to automatically assign addresses to 64 devices on 2 groups of DALI buses at the same time,

In the case of normal bus operation, all devices can be found within 15 minutes. In realizing engineering applications, also

Sometimes the device cannot be found, so you need to scan several times.

Combined with practical experience in engineering, I feel that DALI's automatic address allocation function is a low cost.

This design scheme, in fact, the best and simplest engineering application is to use the DIP switch to set the address reasonably.

This is more convenient for engineering maintenance and engineering changes.

Chat Online 编辑模式下无法使用
Leave Your Message inputting...