Home

DRM004/D: Digitally Addressable Lighting Interface

image

Contents

1. answer GROUP 8 15 flag SEND ANSWER break case QUERY RANDOM ADDRESS H answer RANDOM ADDRESS H flag SEND ANSWER break case QUERY RANDOM ADDRESS M answer RANDOM ADDRESS M flag SEND ANSWER break case QUERY RANDOM ADDRESS L answer RANDOM ADDRESS L flag SEND ANSWER break default break switch command amp 0 0 case GO_TO_SCENE power_failure FALSE lamp StartDimFadeTime SCENE 0 15 ADDR command amp 0x0F break case STORE THE DTR AS SCENE lamp WriteFlash SCENE 0 15 ADDR command 6 OxOF dtr break M p case REMOVE FROM SCENE lamp WriteFlash SCENE 0 15 ADDR command amp OxOF 255 break case ADD TO GROUP if command amp 0 0 lt 7 lamp WriteFlash GROUP 0 7 ADDR GROUP 0 7 1 lt lt command amp 0 0 else lamp_WriteFlash GROUP_8_15_ADDR GROUP 8 15 1 lt lt command amp 0x0F 8 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 150 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c break case REMOVE_FROM_GROUP if command amp 0 0 lt 7 lamp_WriteFlash GROUP_0_7_ADDR GROUP 0 7 amp 1 lt lt command amp 0 0 else lamp_WriteFlash GROUP_8_15_AD
2. SHOW ANSWER ON THE LCD ERROR NO Figure 3 10 main Flowchart SHOW ERROR ON THE LCD DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 38 DALI Master Unit MOTOROLA DALI Master Unit The Software 3 5 2 Central Processor Unit CPU Module The CPU module is responsible for setting up the processor correctly This includes e LVI power supervision Port direction e Port data Built in pullup resistor e IRQ1 interrupt Internal clock speed If the clock has not previously been trimmed this is handled in the module The clock trim value is stored in the FLASH by using the on chip FLASH programming routines The call is made by calling clock write which is defined as follows define clock write _asm ldhx S FDFF njsr 1009 Xn See Figure 3 11 For more information regarding the on chip routines refer to the Motorola Application Note entitled Using MC68HC908 On Chip FLASH Programming Routines Motorola order number AN1831 D Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 39 DALI Master Unit DRM004 Rev 3 0 ENABLE LVI NO YES DISABLE COP INITIALIZE PORTS AND DISABLE IRQ1 CHANGE CLOCK TO 19 6608 MHz lt m F SET TRIM VALUE AND INITIALIZE SCI SEN
3. 2 MSTBA2 O 2 2 10k Figure D 1 DALI Slave Schematic I 1 5 0 x24 gt lt c O gt 3 r lt o m DALI Slave Unit Schematic and Layout O 22 ex CELO var MLD1N06CL o Figure D 2 DALI Slave Layout Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Slave Unit Schematic and Layout 81 DALI Slave Unit Schematic and Layout DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 82 DALI Slave Unit Schematic and Layout MOTOROLA Designer Reference Manual DALI Unit Appendix E DALI Slave Bill of Materials This appendix provides a bill of materials for the DALI Digital Addressable Lighting Interface master unit Refer to Appendix C DALI Master Unit Bill of Materials for the master unit bill of materials Table E 1 DALI Slave Bill of Materials Id Type Description Package Supplier IC1 MC68HC908KX8 Processor SO16 Motorola IC2 MC74AC14 Inverter SO14 Motorola ON IC3 SFH6206 3 Opto coupler SMD Infineon IC4 MC78L05AC Regulator 08 Motorola ON IC5 PVA1354NS Opto relay SMD IR Optorela D1 EL15 21SYGC LED 1206 Everlight D2 BYS10 45 Shott
4. flag SEND ANSWER break case QUERY CONTENT DTR answer dtr flag SEND ANSWER break case QUERY DEVICE TYPE answer 0 For low voltage halogen lamps this is 3 but no extended commands are available flag SEND ANSWER break case QUERY PHYSICAL MINIMUM LEVEL answer PHYSICAL MIN LEVEL flag SE break case QUERY POWER FAILURE if power failure TRU 3 D n A Gl answer OxFF YES flag SEND ANSWER break case QUERY_ACTUAL_LEVEL answer level flag SEND_ANSWER break case QUERY MAX LEVEL answer MAX LEVEL flag SEND ANSWER break case QUERY MIN LEVEL answer MIN LEVEL flag SEND ANSWER break case QUERY POWER ON LEVEL answer POWER ON LEVEL flag SEND ANSWER break Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 149 DALI Slave Source Code Files case QUERY SYSTEM FAILURE LEVEL answer SYSTEM FAILURE LEVEL flag SEND ANSWER break case QUERY FADE answer FADE TIME 4 FADE RATE flag SEND ANSWER break case QUERY GROUPS 0 7 answer GROUP 0 7 flag SEND ANSWER break case QUERY GROUPS 8 15
5. E Digitally Addressable Lighting Interface DALI Unit no edge should exist interrupt cted r no edge should exist stop receiving SE Enable 1 interrupt stop receiving DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 95 DALI Master Unit Source Code Files Enable interrupt The address and command bits values 1 8 rec bit 0 ISCR 0x04 break default if rec gt 6 Store the if temp_value answer rec rec position break rec_value temp value else Signal level stable switch rec_bit case 0 Start bit if rec_position 8 Start bit error too long delay befor dge stop receiving rec_active FALSE ISCR 0x04 Enable interrupt break case 9 First stop bit if rec position 8 if temp_value 0 Stop bit error wrong level stop receiving rec_active FALSE ISCR 0x04 Enable interrupt else rec rec position 0 break case 10 Second stop b if rec position DRM004 Rev 3 0 it 8 Digitally Addressable Lighting Interface DALI Unit 96 DAL Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Receive ready flag ANSWER_EVENT rec_active FALSE ISCR 0x04
6. oye MOTOROLA digital dna intelligence everywhere M68HC08 Microcontrollers WWW MOTOROLA COM SEMICONDUCTORS Digitally Addressable Lighting Interface DALI Unit Using the MC68HC908KX8 Designer Reference Manual DRMO004 D Rev 3 0 3 2002 Digitally Addressable Lighting Interface DALI Unit Using the MC68HC908KX8 By Magnus Grampp Grampp R amp D HB Grampp R amp D Skimmelvagen 14 SE 252 86 Helsingborg Sweden Telephone 46 42 913 95 Fax 46 70 614 96 39 Email info grampp se Web http www grampp se Motorola and the Stylized M Logo are registered trademarks of Motorola Inc DigitalDNA is a trademark of Motorola Inc Motorola Inc 2002 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA 3 Revision History To provide the most up to date information the revision of our documents on the World Wide Web will be the most current Your printed copy may be an earlier revision To verify you have the latest information available refer to http www motorola com semiconductors The following revision history table summarizes changes contained in this document For your convenience the page number designators have been linked to the appropriate location Revision History Revision Date Level Description Number s 5 5 3 DALI Module Description reworded for clarity 57 Figure 3 11 cpu Init
7. 5 4 DALI Receive 5 5 Interface 5 6 HS232 Interface 5 7 Monitor Mode Interface 5 8 PowerSupply 5 9 DALI Slave Software Digitally Addressable Lighting Interface DALI Unit List of Figures DRM004 Rev 3 0 MOTOROLA List of Figures 15 List of Figures Figure Title Page 5 10 maint RR CR od bond CR eae 56 8 11 lamp WriteFlash Flowchart 59 6 1 BALL Demo Application 64 B 1 DALI Master Schematic 72 Bc DALI Master LAYOUT Lu d ud qaaa podre wa basa 73 D 4 DALI Slave Schematic 2 2 5 22 80 Les DALISIave La u Pic a dea dal deed 81 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 16 List of Figures MOTOROLA Designer Reference Manual DALI Unit List of Tables Table Title Page 2 1 Examples of DALI Commands 26 4 1 Description of Stored Parameters 46 42 TypeofAddresses 48 5 1 Default Values for the User Defined Data 58 6 1 DALI Messages Used in the DALI Demo Application 65 Fel StandardCommands 68 A2 Special Commands na 70 C 1 DALI Master Bill of Materials
8. MOTOROLA DALI Slave Source Code Files 161 DALI Slave Source Code Files DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 162 DALI Slave Source Code Files MOTOROLA HOW TO REACH US USA EUROPE LOCATIONS NOT LISTED Motorola Literature Distribution P O Box 5405 Denver Colorado 80217 1 303 675 2140 or 1 800 441 2447 JAPAN Motorola Japan Ltd SPS Technical Information Center 3 20 1 Minami Azabu Minato ku Tokyo 106 8573 Japan 81 3 3440 3569 ASIA PACIFIC Motorola Semiconductors H K Ltd Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po N T Hong Kong 852 26668334 TECHNICAL INFORMATION CENTER 1 800 521 6274 HOME PAGE http Awww motorola com semiconductors Information in this document is provided solely to enable system and software implementers to use Motorola products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Motorola reserves the right to make changes without further notice to any products herein Motorola makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Motorola assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability including without limitation conse
9. DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 104 DALI Master Unit Source Code Files MOTOROLA Interrupt 5 amp 0x80 Clear flag bit Check in which direction the puls if PTA amp 0x10 else command flag NEW DATA interrupt void keys_AddressPulse void TSCO amp 0x80 Clear flag bit Check in which direction the puls handler for address pulse sender if PTA amp 0x02 address else address flag Digitally Addressable Lighting Interface DALI Unit DALI Master Unit Source Code Files Master keys c sender is rotated sender is rotated DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 105 DALI Master Unit Source Code Files F 11 Master Icd h lcd h This header contains definitions for the lcd module Prepared Motorola AB FI Functional level Hardware Revision RIA Rev Date Reason description 001023 Initial version RIA 010212 Released version ifndef LCD define LCD Initialize extern void lcd Init void Print the address and the command on the LCD module extern void lcd ShowData void Print the answer on the LCD module extern void lcd ShowAnswer void Print the error code on the LCD module extern void lcd ShowErr
10. F command gt 0x20 amp amp command lt 0x80 repeated within 100 ms UE Digitally Addressable Lighting Interface DALI Unit 94 DALI Master Unit Source Code Files MOTOROLA Wait until while dali port is idle send_active rec_active ISCR 0x06 send_value 0x00 send position 0 send active TRUE E Disable I Activate Interrupt handler for incoming da interrupt void dali_Start void ISCR 0x06 Disable I answer 0x00 Clear ans rec_bit 0 No bit ha rec_value 0x00 Value is rec_position 0 rec_active TRUE Activate Interrupt handler for timebase mo interrupt void dali_Tick void unsigned char temp_value TBCR 0x08 Acknowledge t DALI Master Unit Source Code Files Master dali c RQ1 interrupt the timer module to transfer ta on the dali port RQ1 interrupt wer s been received low when starting to receive the timer module to receive dule h zs P if rec_active TRUE temp_value amp 0x40 rec if temp value rec value An edge has been dete switch rec_bit case 0 Start bit rec_bittt rec_position break case 9 First stop bit if rec_position gt 6 0 Stop bit erro rec_active FAL ISCR 0x04 break case 10 Second stop bi Stop bit error rec_active FALSE
11. 0x10 Macro definitions define ei _asm define di _asm DRM004 Rev 3 0 cli sei The DA The DA The DA Stores LI address LI command LI answer the last error code Reset due to a hardware software error Keep track of all events Set when new data is set Set when data is to be sent Set if Set if Set if Enable an error has occurred an answer has arrived the demo mode is active interrupt Disable interrupt Digitally Addressable Lighting Interface DALI Unit 86 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master common h Declarations for the embedded ROM flash routines define CTRLBYT unsigned char 0x0048 Address to a variable containing a erase flag define CPUSPD unsigned char 0x0049 Address to a variable containing the cpu speed define LADDR unsigned int 0x004A Address to a variable containing the last address to write define DATA unsigned char 0x004C Address to the data array to be written into flash define clock write asm ldhx FDFF njsr 1009 n endif Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 87 DALI Master Unit Source Code Files F 3 Master cpu h contains definitions for the cpu module cpu h Fr This
12. Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 99 DALI Master Unit Source Code Files F 8 Master iokx8 h IO DEFINITIONS FOR MC68HC908KX8 Copyright c 2000 by Motorola AB Based on definition from Cosmic dA define uint PORTS section tiny volatile char tiny volatile char tiny volatile char tiny volatile char tiny volatile char SCI section tiny vola tiny vola tiny vola tiny vola tiny vola tiny vola tiny vola KEYBOA tiny vola tile char tile char tile char tile char tile char tile char tile char RD section tile char unsigned int keyboard status control register tiny vola tile char TIMEBASE section tiny volatile char IRQ section tiny volatile char CONFIG section tiny volatile char tiny volatile char TIMER section tiny volatile char tiny volatile uint DRM004 Rev 3 0 PTA 0 00 0 01 DDRA 0 04 DDRB 80x05 PTAPUE 0 0 5 80 13 scc2 80 14 SCC3 80 15 SCS1 80 16 SCS2 Ox17 SCDR 80 18 SCBR 80 19 KBSCR 0 1 KBIER 80 1 TBCR 0 1 ISCR 0 1 1 Q0xle CONFIG2 00 1 5 80x20 TCNT 80x21 port A port B data direction port A
13. Section 2 DALI Demonstration Board 2 1 Contents rc 23 23 Contents ofthe System 24 24 Systemi 24 25 System 52222 2 55 552225 52 5 25 SD System Operation aani 25 27 EAMES I u uyu ssh ayawaska 26 2 2 Introduction This section describes how to connect and use a DALI Digital Addressable Lighting Interface demonstration board A DALI demonstration board can be obtained through Motorola It is always delivered with the software already loaded so only a power supply and four lamps have to be connected to get the system started NOTE Itis necessary to read this section to get an understanding of the system even if you do not have a demonstration board Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Demonstration Board 23 DALI Demonstration Board 2 3 Contents of the System Five printed circuit cards and the cables connecting them are mounted on the DALI demonstration board The system also consists of One 4 wire cable for communication with a PC see Section 6 PC Software One 6 wire cable for replacing the software see 3 6 Upgrading the Software Master and 5 6 Upgrading the Software Slave e CD ROM containing all software and documentation 2 4 System Overview The DALI demonstration board consists of a DALI mast
14. break control register ERUPT status register 1 ERUPT status register 2 ERUPT status register 3 SH SH SH test control register control register block protect register auxiliary register address register address register low DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 101 DALI Master Unit Source Code Files near volatile near volatile LVI section KC near volatile COP section near volatile undef uint DRM004 Rev 3 0 char char char char BRKL BRKSCR LVISR COPCTL 80 Oxfe0b 0 0 QOxffff BREAK address register high BREAK status ctrl register LVI status register COP control register Digitally Addressable Lighting Interface DALI Unit 102 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master keys h F 9 Master keys h keys h Ar This header contains definitions for the keys module Prepared Motorola AB Functional level Hardware Revision RIA Rev Date Reason description PIA 001025 Initial version RIA 010212 Released version ifndef KEYS define KEYS Initialize extern void keys_Init void Interrupt handler for send button extern interrupt void keys_SendButton void Interrupt handler for command pulse sender extern int
15. Enable 1 interrupt break default The address and command bits if rec position 10 Data bit error too long delay befor dge rec_active FALSE ISCR 0x04 Enable 1 interrupt break if send_active TRUE if send_position amp 0 03 0 amp 0 80 send_value if send_position 0 send value 0x80 Second half of start bit 5 send position 4 amp amp send positionc 128 Extract bit level Check if address or command if send positionc 68 Address temp_value address 64 send position 8 else Command temp_value command gt gt 128 send position 8 Check if first or second half of data bit if send_position amp 0x04 First half if temp_value 0x00 send_value 0x80 else send_value 0x00 Digitally Addressable Lighting Interface DALI Unit Master dali c stop receiving amp 0 01 amp 0x01 DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 97 DALI Master Unit Source Code Files DRM004 Rev 3 0 if else Second half if temp_value 0x00 send_value 0x00 else send_value 0x80 if send_position 132 send_value 0x80 Start of stop bit and settling time if send_position 160 ISCR 0x04 Enable 1 interrupt if send position 236 s
16. Flowchart Clock frequency changed 40 from 9 8304 MHz to19 6608 MHz F 4 Master cpu c Code replaced 89 F 6 Master dali c Code replaced 93 November 1 2001 F 15 Master rs232 c Code replaced 113 G 5 Slave cpu c Code replaced 122 G 7 Slave dali c Code replaced 125 G 11 Slave lamp c Code replaced 135 G 14 Slave rs232 c Code replaced 159 Appendix B DALI Master Unit Schematic and Layout Replaced 71 November master schematic and master layout for readability 2 2001 Appendix D DALI Slave Unit Schematic and Layout Replaced 79 slave schematic and slave layout for readability March 2002 3 G 11 Slave lamp c Code changed to buffered PWM 135 DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 4 MOTOROLA Designer Reference Manual DALI Unit List of Sections Section 1 General Description 19 Section 2 DALI Demonstration Board 23 Section 3 DALI Master Unit 27 Section 4 DALI Protocol Standard 45 Section 5 DALI Slave Unit 49 Section 6 PC Software 63 Appendix A DALI Instruction Set 67 Appendix B DALI Master Unit Schematic and 71 Appendix DALI Master Unit Bill of Materials 75 Appendix D DALI Slave Unit Schematic and LAVOE
17. 0x00 error 0x00 flag 0x00 cpu Init Tod rnitt s keys Init DRM004 Rev 3 0 The DALI address The DALI command The DALI answer Stores the last error code Keep track of all events Initialize when starting Initialize when starting Initialize when starting Initialize when starting Initialize when starting ct Initialize the cpu module Initialize the lcd module he keys module ct Initialize Digitally Addressable Lighting Interface DALI Unit 110 DALI Master Unit Source Code Files MOTOROLA rs232_Init dali_Init ei while 12 21 COPCTL 0x00 DALI Master Unit Source Code Files Master main c Initialize the keys module Initialize the dali module Enable interrupt Loop forever Clear COP counter NEW_DATA flag can be set from the keys module the rs232 module or the dali module if flag amp N flag amp lcd ShowDa Update lcd with new address and command NI EW DATA EW DATA Clear NEW_DATA flag END_DATA flag can be set from the keys module the rs232 module or the dali module if flag amp SEN D_DATA flag amp SEND DATA dali SendData Send address and command on the dali port ANSWER EV if flag amp AN
18. data direction port B pull up enable port A SCI control register 1 SCI control register 2 SCI control register 3 SCI status register 1 SCI status register 2 SCI data register SCI baud rate keyboard interrupt enable timebase module control IRQ status control register configuration register 1 configuration register 2 timer status ctrl register timer counter register Digitally Addressable Lighting Interface DALI Unit 100 DALI Master Unit Source Code Files MOTOROLA tiny volatile char TCNTH 80 21 tiny volatile char TCNTL 80 22 tiny volatile uint TMOD 80 23 tiny volatile char TMODH 0 23 tiny volatile char TMODL 80 24 tiny volatile char TSCO 80 25 tiny volatile uint TCHO 80 26 tiny volatile char 0x26 tiny volatile char TCHOL 0 27 tiny volatile char 5 1 0 28 tiny volatile uint 0 29 tiny volatile char 0 29 tiny volatile char 11 0 2 ICG section tiny volatile char ICGCR 0x36 tiny volatile char ICGMR 0 37 tiny volatile char 0x38 tiny volatile char ICGDVR 0x39 tiny volatile char ICGDSR 0x3a A D section AY tiny volatile char ADSCR 0 3 tiny volatile char ADR 0x3d tiny volatile char ADICLK 0x3e SIM section near volatile char SBSR 0 00 near volatile char SRSR 0 0
19. 0 00 7 OxOOFD 0 0104 0 010 0x0113 Ox011B 0x0122 0x012A 0x0133 0x013B 0x0144 0 014 0x0156 0 0160 0x0169 0 0173 0 017 0x0188 0x0193 OxO19E 0 01 Ox01B5 0 01 2 0 01 1 0 01 8 0 01 5 0x0203 0x0212 0 0220 0x022F 0x023F 0x024F 0x025F 0x0270 0x0281 0x0293 0 02 5 0 02 8 0 02 0x02DF 0 02 0x0308 0 031 0x0334 0x0344A 0x0362 0x037A 0x0392 0x03AC 0x03C6 0 03 0 0x03FC 0x0418 0 0435 0x0453 0x0472 0x0491 Ox04B1 0x04D3 0 04 5 0 0518 0x053C 0 0561 0x0587 OxO5AE 0 05 7 Number of timer ticks for each fade time tic const unsigned int fade tick 15 35 50 71 100 141 200 283 400 566 800 1131 1600 2263 3200 4526 Number of level steps during 200 ms tic const unsigned char fade step 15 72 51 36 25 18 13 9 6 4 3 2 2 1 1 1 tic unsigned char level The light level tic unsigned char search address h Search address high tic unsigned char search address m Search address middle tic unsigned char search address 1 Search address low tic unsigned char dtr The DTR register tic unsigned char last channel Last channel register used tic unsigned char state no Holds the current state for the timer tic unsigned int state time Time until state or level is changed tic unsigned char fade start level Start level before fading tic unsigned char fade stop level Stop level after fading
20. 0x40 ISCR 0x04 break case 18 Second stop bit Stop bit error rec_active FALSE TSC 0x40 E n DRM004 Rev 3 0 Acknowledge th interrupt cted r no edge should exist SE Enable timer overflow interrupt Enable 1 interrupt o edge should exist nable timer overflow interrupt stop receiving stop receiving Digitally Addressable Lighting Interface DALI Unit 126 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave dali c ISCR 0x04 Enable IRQ1 interrupt break default The address and command bits if rec_position gt 6 Store the values if temp value Check if address or command if rec_bit lt 8 address 1 lt lt 8 rec_bit else command 1 16 rec bit rec_bittt rec_position 0 break rec_value temp_value else Signal level stable switch rec_bit case 0 Start bit if rec_position 8 Start bit error too long delay befor dge stop receiving rec_active FALSE TSC 0x40 Enable timer overflow interrupt ISCR 0x04 Enable 1 interrupt break case 17 First stop bit if rec_position 8 if temp value 0 Stop bit error wrong level stop receiving rec_active FALSE TSC 0x40 Enable timer overflow interrupt ISCR 0x04 Enable 1 interru
21. 79 Appendix E DALI Slave Bill of Materials 83 Appendix F DALI Master Unit Source eo d 85 Appendix DALI Slave Source Code Files 117 Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA List of Sections 7 List of Sections DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 8 List of Sections MOTOROLA Designer Reference Manual DALI Unit Table of Contents Section 1 General Description LI d 19 19 lub Design acoA hohe ER REA 19 Jab ACC toe REOR COE Xi weds 20 Section 2 DALI Demonstration Board ET OUI 23 22 os iso rm 23 23 Contents of the System 24 2 4 System 24 25 gt ORO Qe eee Rea ener e en 25 26 System 25 20 ee ee ee xd di RR OE RR 26 Section 3 DALI Master Unit CON Hind Fa e QEON D EE OR pana 27 Sc MOs 28 Eee ee 28 WU 29 3 4 1 Microcontroller Unit MCU 30 3 4 2 31 3 4 3 Keyboard IIBITHOB L cade cd C Re 6b CORREO OR I cR Dd deni 92 Digitally Addressable Lighting Interface DALI Uni
22. PTB6 o DALI ty o IC3 0v Figure 5 4 DALI Receive Circuit DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 52 DALI Slave Unit MOTOROLA DALI Slave Unit Hardware 5 4 3 Lamp Interface Controlling the lamp current is done by a protected power MOSFET 1 The processor controls the transistor directly PTA2 NOTE current is fairly high and could cause damage if a hardware error occurs To detect lamp failure a current sensing circuitry is included This is done by letting the lamp current flow over a shunt resistance R2 The generated voltage is measured by the built in analog to digital A D converter in the processor PTB3 AD3 See Figure 5 5 12V PTA2 lt Tl i s PTB3 AD3 4 KYB Figure 5 5 Lamp Interface Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Slave Unit 53 DALI Slave Unit 5 4 4 RS232 Interface Only JP1 is placed on the slave unit For communication over an RS232 interface a cable has to be connected to the master unit See Figure 5 6 12V L PTBA RXD PTB5 TXD m OV Figure 5 6 RS232 Interface 5 4 5 Monitor Mode Interface The monitor mode interface only consists of the pin header JP2 and DIP switch S1 For simplicity the rest of the interface is located on the master unit and has to b
23. tic unsigned int fade total Total time for fade tic unsigned char repeat time Time until repetation time expires tic unsigned char repeat address Address that should be repeated tic unsigned char repeat command Command that should be repeated tic unsigned int address time Time until addressing commands are illegal tic unsigned char power failure Flag is true until certain commands has arrived tic unsigned char limit error True if the last requested level was out of limit tic unsigned char measure time Time until lamp current can be measured DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 137 DALI Slave Source Code Files Write data into flash at address static void lamp_WriteFlash unsigned char flash_address unsigned char new_data unsigned char index Set all variables necessary CTRLBYT 0x00 Page erase CPUSPD Ox4F 4 19 6608 LADDR unsigned int STOP OF FLASH BUFFER Last address in the flash memory Copy data to buffer for index 0 index 32 1 DATAtindex START_OF_FLASH_BUFFER index Merge the new data into the data buffer DATA unsigned char flash_address START_OF_FLASH_BUFFER new_data di Disable all interrupts during flash erase and flash write Place erase start address in H X and call the erase routine flash erase Place write start address in H X and call the write rou
24. 75 E 1 DALI Slave Bill of Materials 83 Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA List of Tables 17 List of Tables DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 18 List of Tables MOTOROLA Designer Reference Manual DALI Unit 1 1 Contents 1 2 Introduction Section 1 General Description 1 2 Init od Uc OE us cua dada 19 14 Design OvervieW 19 1 4 Introduction to DALI 20 This document defines the reference design for a low cost DALI Digital Addressable Lighting Interface It shows how to use the Motorola MC68HC908KX8 KX2 in a master slave configuration where the units are communicating with a simple protocol The communication protocol the hardware and the software are described in this document and although the application is intended for illumination control the structure is also applicable for similar purposes 1 3 Design Overview The design is divided into two separate units a DALI master unit and a DALI slave unit The DALI slave unit can set the luminosity of a connected lamp The desired brightness level is set by the DALI master unit which has a simple human interface consisting of a four digit liquid crystal display LCD two shaft encoders and a push button The DALI master unit sends the wanted values to the connected DALI
25. Be 1 Clear the Overflow Flag Bit ER ON L EVE if state time 0 state_no IDLE_STAT lamp_SetLevel POW break DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 154 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c case FADF_STATE state_time if state_time 0 State no IDLE STATE Calculate fade if fade_start_level gt fade_stop_level Dim down if fade_stop_level 0 if state_time 0 new_level 0 else Use MIN_LEVEL instead of 0 diff_level unsigned char unsigned long fade_start_level unsigned long MIN_LEVEL unsigned long fade total unsigned long state_time unsigned long fade total new_level fade_start_level diff_level else diff_level unsigned char unsigned long fade start level unsigned long fade_stop_level unsigned long fade_total unsigned long state_time unsigned long fade total new level fade start level diff level else Dim up diff level unsigned char unsigned long fade stop level unsigned long fade start level unsigned long fade total unsigned long state time unsigned long fade total new level fade start level diff level if new level level lamp_SetLevel
26. Slave Source Code Files 119 DALI Slave Source Code Files G 3 Slave common h common h This header contains common definitions Prepared Motorola AB Functional level Common Revision RIA Rev Date 001023 P1B 010201 RIA 010212 ifndef COMMON define COMMON define TRUE 1 define FALSI Gl 0 Reason description Initial version Added declaration for embedded ROM flash routines Released version Global definition extern unsigned char address The DALI address extern unsigned char command The DALI command extern unsigned char answer The DALI answer extern unsigned int flag Keep track of all events define NEW_DATA 0x01 Set when new data has arrived define SEND_ANSWER 0x02 Set when an answer is to be sent define SIGNAL_ERROR 0x04 Set when the DALI signal level has been low for more than 500 ms Macro definitions define _asm cli Enable interrupt define di _asm sei Disable interrupt Declarations for the embedded ROM flash routines define CTRLBYT unsigned char 0x0048 Address to a variable containting a erase flag define CPUSPD Address to define LADDR Address to define DATA Address to a a unsigned char 0x0049 variable containing the cpu speed unsigned int 0x004A variable containing the last address to write unsigned char 0x004C the dat
27. Spacing 5 mm C3 Ceramic 0 22 uF 63 V Capacitor Spacing 5 mm C4 Ceramic 0 1 uF 63 V Capacitor Spacing 5 mm C5 Ceramic 2200 pF 63 V Capacitor Spacing 5 mm C6 Ceramic 2200 pF 50 V Capacitor Spacing 5 mm C7 Ceramic 2200 pF 50 V Capacitor Spacing 5 mm C8 Ceramic 33 pF 50 V Capacitor Spacing 5 mm C9 Ceramic 0 1 uF 63 V Capacitor Spacing 5 mm C10 Ceramic 0 33 uF 63 V Capacitor Spacing 5 mm C11 Ceramic 0 1 uF 63 V Capacitor Spacing 5 mm C12 Ceramic 0 33 uF 63 V Capacitor Spacing 5 mm C13 Electrolytic 10 uF 16 V Capacitor Spacing 2 5 mm DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 76 DALI Master Unit Bill of Materials MOTOROLA Table C 1 DALI Master Bill of Materials Sheet 3 of 3 DALI Master Unit Bill of Materials Id Type Description Package Supplier C14 Electrolytic 10 uF 16 V Capacitor Spacing 2 5 mm C15 Electrolytic 10 uF 16 V Capacitor Spacing 2 5 mm C16 Electrolytic 10 uF 16 V Capacitor Spacing 2 5 mm 51 Multimec 3CTL9 Push button Hole MEC 52 16 24204 Shaft encoder Hole Alps 53 16 24204 Shaft encoder Hole Alps S4 NDIR 04ST 4 p DIP switch Hole APEM JP1 MTA100 156 6 p Connector 2 54 mm straight AMP JP2 Not mounted JP3 Not mounted JP4 MTA100 156 4 p Connector 2 54 mm straight AMP JP5 MTA100 156 4 p Connector 2 54 mm straight AMP JP6 MTA100 156 6 p Connector 2 54 mm straight AMP X1 MSTBA 2 5 4 G 5 08 Con
28. address of the receiver and the second byte contains the actual command These commands are listed in Table A 1 Some special commands use both bytes Since these commands do not have an address byte they are broadcasted to every unit The special commands are listed in Table A 2 NOTE Table 1 and Table 2 The DTR Data Transfer Register is a memory location in the DALI unit used for temporary data transfer The answer YES corresponds to the hexadecimal value FF If no answer is received it will be interpreted as the answer NO Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Instruction Set 67 DALI Instruction Set Table A 1 Standard Commands xn Mas Description Answer 00 Extinguish the lamp without fading _ 01 Dim up 200 ms using the selected fade rate 02 Dim down 200 ms using the selected fade rate 03 Set the actual arc power level one step higher without fading 04 Set the actual arc power level step lower without fading _ 05 Set the actual arc power level to the maximum value _ 06 Set the actual arc power level to the minimum value 07 Set the actual arc power level step lower without fading 08 Set the actual arc power level step higher without fading _ 10 Scene Set the light level to the value stored for the selected scene 20 Reset the parameter
29. else command SCDR first TRUE Next data is an address flag NEW DATA SEND DATA flag amp DEMO MODE Clear demo mode DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 114 DALI Master Unit Source Code Files MOTOROLA F 16 Master vector c vector c Js This module contains the interrupt vector Prepared Motorola AB Functional level Hardware Revision RIA Rev Date Reason description P1A 001023 Initial version RIA 010212 Released version include cpu h include keys h include rs232 h include dali h void const _vectab dali_Tick Timebase module cpu_Trap ADC conversion complete keys_SendButton Keyboard cpu_Trap SCI transmit rs232 ReceiveData SCI receive cpu_Trap SCI receive error cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved cpu_Trap TIM overflow keys_CommandPulse TIM channel 1 keys_AddressPulse TIM channel 0 cpu Trap CMIREQ dali Start 1 cpu Trap SWI _stext Reset Digitally Addressable Lighting Interface DALI Unit DALI Master Unit Source Code Files Master vector c DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 115 DALI Master Unit Source Code Files DRM004 Rev 3 0 Digitally Addressable Lighting Interface DA
30. header Prepared Motorola AB Functional level Hardware Revision RIA Rev Date Reason description 001023 RIA 010212 Initial version Released version ifndef CPU define CPU Initialize extern void cpu_Init void Interrupt handler for reset extern interrupt void _stext void Trap lost interupts extern interrupt void void fendif DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 88 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master cpu c F 4 Master cpu c cpu c Fr This module handles all cpu related tasks Prepared Motorola AB Functional level Hardware Revision 1 Rev Date Reason description 001023 Initial version PIB 000201 Added automatic clock calibration RIA 010212 Released version RIB 011016 Adapted to new clock speed include common h include iokx8 h define TRIM_FACTOR_ADDR unsigned char OxFDFF define TRIM FACTOR TRIM FACTOR ADDR Internal clock generator trim factor Initialize void cpu Init void unsigned char trimmed unsigned char ser_rec unsigned char dali_rec Initialize LVI to 5V if TRIM FACTOR OxFF Initialize LVI to 5 CONFIG2 0x08 else Initialize LVI to 5V and disable COP CONFIG2 0x09 Initialize po
31. is stored in flash Wait until the signals are stable Wait until transmit buffer is empty Bit pattern Page erase 4 19 6608 Last address in the flash memory Digitally Addressable Lighting Interface DALI Unit 90 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master cpu c Trap lost interupts interrupt void cpu_Trap void while 1 1 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 91 DALI Master Unit Source Code Files F 5 Master dali h dali h This header contains definitions for the dali module Prepared Motorola AB Functional level Hardware Revision RIA Rev Date Reason description P1A 001110 Initial version RIA 010212 Released version ifndef DALI define DALI Initialize extern void dali_Init void Sends the DALI address and command on the dali port extern void dali SendData void Interrupt handler for incoming data on the dali port extern interrupt void dali Start void Interrupt handler for timebase module extern interrupt void dali Tick void endif DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 92 DALI Master Unit Source Code Files MOTOROLA F 6 Master dali c DALI Master Unit Source Code Fil
32. lt z IC6 So 4 x2 OV 12V 12 V 1 gt PTAO O O IRQO Vist PTB6 0SC1 Q Q i O Q JP1 JPG 98304MHz OV QA1 0v Figure 3 7 Monitor Mode Interface Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 35 DALI Master Unit 3 4 7 Power Supply 3 5 The Software DRM004 Rev 3 0 The linear regulator IC2 and IC8 makes the 5 volt conversion There is no external protection against over voltages or EMI interference but the diode D1 serves as protection against wrong polarity The input voltage can vary between 7 and 30 volts for the 5 volt conversion but the DALI interface requires that the voltage be kept within 10 to 14 volts See Figure 3 8 12V 5V gt 2108 O 01 O e 0v 0v Figure 3 8 Power Supply The software handles the DALI the RS232 communication tasks and the human interface It is based around a main module that first initializes common variables and the utility modules then goes into an endless loop The different utility modules are updated through interrupts If an event occurs in one utility module which leads to the need to act in another utility module a flag is set The main module scans these flags and takes action accordingly No call is made directly from one utility module to another Since the structure is based on what action the different software m
33. send_value 0x00 Second half if temp_value 0x00 send_value 0x00 else send_value 0x80 if send_position 96 send_value 0x80 Start of stop bit and settling time if send_position 112 send_active FALSE TSC 0x40 Enable timer overflow interrupt ISCR 0x04 Enable IRQ1 interrupt pj J send_position if PTB amp 0x40 low_counter 0 else If the signal level has been low for 500 ms then go to failure level low_counter if low_counter gt 4800 low_counter 0 flag SIGNAL ERROR Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 129 G 8 Slave dali Ikf DALI Slave Source Code Files LINK COMMAND FILE Example for 68HC908KX8 Copyright c 2000 by Motorola AB seg text b 0 000 mOx1E00 nCODE sROM program start address tseg const a CODE it sRO constants and strings 5 bsct b 0x70 m0x90 nZPAGE sRAM zero page start address seg ubsct a ZPAGE nUZPAGE sRAM seg data a UZPAGE nIDATA sRAM data start address seg bss a nUDATA sRAM startup routine main o application program cpu o dali o 5232 0 lamp o C NCOSMICNEVALO8NLibNMlibi h08 C NCOSMICNEVALO8NLibNMlibm h08 seg vector o const b OxFFDC tdef
34. slave units The communication is based around the DALI standard which is an asynchronous half duplex serial protocol over a two wire differential bus See Figure 1 1 Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA General Description 19 General Description e e e DALI DALI DALI SLAVE SLAVE SLAVE A A Y Y Y DALI ima MASTER gt 4 l l Figure 1 1 The DALI Bus System The software is re programmable by using the built in monitor mode interface Both the DALI master unit and the DALI slave unit can be controlled through an RS232 interface A DALI demonstration board consisting of a DALI master unit and four DALI slave units is obtainable through Motorola 1 4 Introduction to DALI DRM004 Rev 3 0 The lighting industry has developed a new standard for communication with electronic ballast ECG It is an interface standard for communication between a controller and the ECGs This standard goes by the name of DALI Digital Addressable Lighting Interface and it will be included as an appendix to ECG standard IEC 929 DALI is designed for the use of standard components and for simple wiring which means low costs Fields of application may be Day lighting and night lighting Different lighting for varying activities in multi purpose rooms such as hotels conference rooms etc Possibilities of dimming t
35. to buffered PWM mode TSC amp 0x20 Start counter Handles new data void lamp_HandleData void unsigned int group Check if this message is for this unit if address amp OxE1 0xAl amp amp address amp 1 0 1 amp amp Special command or broadcast message if address amp 0 0 0 80 Group address group GROUP_8_15 lt lt 8 GROUP_0_7 if group gt gt address amp 0 1 gt gt 1 amp 0x01 0 Not in this group return if address amp 0x80 0 00 Short address if address amp Ox7E gt gt 1 SHORT_ADDR Gl Wrong short address return Message is intended for his unit Check if repetetion shall be interrupted if repeat_time 0 Waiting for repeated messag address amp OXFE 0xF I Ez DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 152 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c if address repeat_address command repeat_command Ignore message and clear repeat timer repeat_time 0 return if address amp 0x01 0 Direct arc power control command power_failure FALSE lamp StartDimFadeTime command return Check if commands shall be repeated if address amp 0 0 address amp 0 0 0 0 Special command if add
36. void Handles new data tern void lamp HandleData void Set the lamp to failure level tern void lamp FailureLevel void Interrupt handler for the timer interface module tern interrupt void lamp Tick void Digitally Addressable Lighting Interface DALI Unit 134 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c G 11 Slave lamp c lamp c This module controls the lamp Prepared Motorola AB Lf Functional level Hardware Z Revision R1C Rev Date Reason description PIA 001215 Initial version P1B 000201 Improved current measurement RIA 010212 Released version RIB 011016 Adapted to new clock speed 1 011210 Changed to buffered PWM The timer interface module TIM and the analog to digital converter ADC are used include common h include iokx8 h include command h Flash memory data definitions define START_OF_FLASH_BUFFER unsigned char 0 80 OxFDEO define STOP OF FLASH BUFFER unsigned char OxFD9F OxFDFF define POWER LEVEL ADDR unsigned char OxFD80 Power on level address define SYSTEM FAILURE LEVEL ADDR unsigned char OxFD81 System failure level address define MIN LEVEL ADDR unsigned char OxFD82 Minimum level address define
37. which is called the short address There is also the possibility of assigning a slave unit to a group Up to 16 groups can exist and a slave unit can belong to several groups A message can also be broadcasted to all slave units Table 4 2 Type of Addresses Type of Addresses Byte Description Short address OAAAAAAS AAAAAA 0 to 63 S 0 1 Group address 100AAAAS AAAA 0 to 15 S 0 1 Broadcast address 11111115 S 0 1 Special command 101 1 CCCC command number The command byte is to be interpreted as an arc power level if bit S is O The arc power can be between 00 off and FE maximum power level A 1 in the position S means that the command byte is to be interpreted as a DALI command Refer to Appendix A DALI Instruction Set for a list of all available commands DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 48 DALI Protocol Standard MOTOROLA Designer Reference Manual DALI Unit 5 1 Contents 5 2 Introduction DE 5 3 5 4 5 4 1 5 4 2 5 4 3 5 4 4 5 4 5 5 4 6 5 5 5 5 1 5 5 2 5 5 3 5 5 4 5 5 5 5 6 5 6 1 5 6 2 Section 5 DALI Slave Unit ida sasana woh Ea ERE Spe A SEE 49 3 0 us s suyun sk ewe ua rre 50 24s 7 e 50 Microcontroller Unit MCU 51 DALI PUGS ce dw de del Yo org dong o GE e ea 51 Lamp B
38. 0 Digitally Addressable Lighting Interface DALI Unit 144 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c case UP if level 0 amp amp level MAX_LEVEL fade_start_level level if fade step FADE RATE 1 MAX LEVEL level fade stop level MAX LEVEL fade total unsigned int MAX LEVEL level 10 fade step FADE RATE 1 No of ms until MAX LEVEL is reached else fade stop level level fade_step FADE_RATE 1 fade total 10 200 ms state_time fade_total state_no FADE_STATE break case DOWN if level 0 amp amp level MIN_LEVEL fade_start_level level if fade_step FADE_RATE 1 gt level MIN_LEVEL fade stop level MIN LEVEL fade total unsigned int level MIN LEVEL 10 fade step FADE RATE 1 No of ms until MIN LEVEL is reached else fade stop level level fade step FADE RATE 1 fade total 10 200 ms state time fade total state no FADE STATE break case STEP_UP if level 0 amp amp level MAX_LEVEL lamp_SetLevel 1 141 state_no IDLE_STATE break case STEP_DOWN if level 0 amp amp
39. 080 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 107 DALI Master Unit Source Code Files const unsigned long digit4 16 Takes data and sends 0xC000000F 0x60000003 0 000000 0xC000000C 0x00000003 0 0000006 0 0000003 0 2000000 it to OxA000000D 0 000000 0 000000 OxEO00000C driver static void lcd SendData unsigned long data unsigned char index for index 0 if data amp 0x01 PTB 0x04 else PTB amp 0x04 data gt gt 1 amp 0 01 PTB 0x01 Initialization void lcd Init void PTB lcd_SendData digit1 0x00 0x02 COLON index lt 32 Set LOAD high Set high Set DATA low Toggle CLOCK PTB1 digit2 0x00 0xA0000007 0x80000003 0x6000000E 0 0000008 2 2 PTBO digit3 0x00 digit4 0x00 Print the address and the command on the LCD module void lcd ShowData void unsigned long result result digitl address amp 0 0 gt gt 4 Add digit 1 amp 2 result digit3 command amp 0 0 gt gt 4 Add digit 3 amp 4 result COLON Add lcd SendData result DRM004 Rev 3 0 digit2 address amp 0 0 digit4 command am
40. 1 near volatile char SBFCR 0 03 section near volatile char G0xfe04 near volatile char INT2 0 05 near volatile char INT3 0 06 FLASH section near volatile char FLTCR 0 07 near volatile char FLCR Q0xfe08 near volatile char FLBPR GOxff7e BREAK section near volatile char BRKAR 0 02 near volatile uint BRK 0 09 near volatile char 0 09 Digitally Addressable Lighting Interface DALI Unit tim tim tim tim tim tim tim tim tim tim tim tim tim ICG ICG ICG ICG ICG A D A D A D SIM SIM SIM INT INT INT FLA FLA FLA BRE BRE BRE DALI Master Unit Source Code Files Master iokx8 h counter high counter low modulo register modulo high modulo low han 0 status ctrl han register han high han low han status ctrl han register han high han low Cr er er er er er control register multiplier register trim register divider control register stage control register status ctrl register data register input clock register break status register reset status register
41. 15 mE Mu S oss GND o 2220 n E 5 5 dsl c x9 5 250 als S gt Z wl 3 2 1 LIAL 2 8 4 2 8 8 paca KER KKK STAA 9 IZILI MECSCTLO s 14 OOOO 555559556555 Ps2 KKK RRR KKK NY TEST2 cn uu c T lt 92 52 C7 022rF 4 2 xa c3 GND ht 45V rj H Q 22 92 E gi t INVERT V NONNVERT a LIVICZZ21BIN GND R6 47k 92 x 4 337 3 BAS x T e 3 3 BC337 a x 2 2 n c Figure B 1 DALI Master Schematic Sheet 1 of 2 DALI Master Unit Schematic and Layout l8 i l8 15 931 gl T T 9 E 16 5 Figure B 1 DALI Master Schematic Sheet 2 of 2 o N oj a FOH ay N Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Schematic and Layout 73 DALI Maste
42. 50 doa ae bea 50 Microcontroller Unit MCU 51 DALI MENICE ooa opp ea beoi DL ode ee 51 Lamp ri o ewe T 53 85232 Interface 54 Monitor Mode Interface 54 Power Supply ae a ae op ode RC ACIE waka 55 Digitally Addressable Lighting Interface DALI Unit 10 Table of Contents MOTOROLA 5 5 5 5 1 5 5 2 5 5 3 5 5 4 5 5 5 5 6 5 6 1 5 6 2 6 1 6 2 6 3 6 4 6 5 Table of Contents TNE SOWIE Led d v ROCA VEREOR CI E EROR 55 Mah Cp m 56 Central Processor Unit CPU Module 57 DALI PP PH 57 Lamo 0 mn 57 rese La ac dao aaa Rok dO 77 59 Upgrading the Sofware s us dcs REO ECRIRE e TR ORC RC 60 Board 60 Reprogramming the Code 60 Section 6 PC Software COMEM S iade cd se 63 Introduction 63 il 63 User manual siaaa 64 The Source 65 Appendix A DALI Instruction Set Appendix B DALI Master Unit Schematic and Layout Appendix C DALI Master Unit Bill of Materials Appendix D DALI Slave Unit Schematic and Layout Appendix E DALI Slave Bill of Materials Digitally Addressable Lighting
43. A PTA amp while 0x08 1 1 COPCTL 0x00 if if module NEW_DATA flag can be set flag amp NEW_DATA flag amp NEW_DATA lamp HandleData SEND ANSW flag amp SI R flag set ND_ANSWER flag amp SEND ANSWER dali SendAnswer rs232 SendAnswer SIGNAL ERROR flag can be flag amp SIGNAL ER flag amp SIGNAL lamp_Failure ROR ERROR Level Digitally Addressable Lighting Interface DALI Unit DALI Slave Source Code Files Slave main c Switch on LED Loop forever Clear the COP counter from the dali module or from the rs232 Clear the NEW_DATA flag from the lamp module Clear the SEND_ANSWER flag Send answer on the dali port Send answer on the rs232 port set from the dali module Clear the SIGNAL_ERROR flag DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 157 DALI Slave Source Code Files G 13 Slave rs232 h rs232 h This header contains definitions for the rs232 module Prepared Motorola AB FI Functional level Hardware Revision RIA Rev Date Reason description P1A 001027 Initial version RIA 010212 Released version ifndef RS232 define RS232 Initialize extern void rs232 Init void Sends the DALI answer on
44. ADICLK SBSR SRSR SBFCR 2 INT3 FLTCR FLBPR 80x20 80x21 80 21 80 22 0 23 0 23 0 24 0 25 0 26 0 26 0 27 0 28 0 29 0 29 0 2 0 36 0 37 0 38 0 39 0x3a 80 3 0 80 3 0 00 0 01 0 03 80 04 0 05 0 06 0 07 0 08 QOxff7e tim tim tim tim tim tim tim tim tim tim tim tim tim tim tim ICG ICG ICG ICG ICG A D A D A D SIM SIM SIM INT INT INT eI er er er er er er status ctrl register counter register counter high counter low modulo register modulo high modulo low han 0 status ctrl han register han high han low han status ctrl han register han high han low control register multiplier register trim register divider control register stage control register status ctrl register data register input clock register break status register reset status register break control register ERUPT status register 1 ERUPT status register 2 ERUPT status register 3 FLASH test control r
45. D converter in the central processor unit CPU An LED is also connected to the CPU to enable debugging even if no lamp is connected See Figure 5 1 DALI INTERFACE LED LAMP CPU INTERFACE POWER SUPPLY Figure 5 1 DALI Slave Unit Schematics layout and part list can be found in Appendix D DALI Slave Unit Schematic and Layout and Appendix E DALI Slave Bill of Materials DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 50 DALI Slave Unit MOTOROLA NOTE DALI Slave Unit Hardware The slave unit in a real life application is probably part of an electronic ballast ECG To simplify the design a high voltage fluorescent tube is replaced by a low voltage halogen light bulb The current flowing through a halogen light bulb is high approximately 1 A so the connected cables have to be dimensioned accordingly The construction is protected against temporary short circuit conditions but a permanent short circuit condition will overheat some components with permanent damage as a consequence There is no hardware included on the slave unit to enter the monitor mode The slave unit can be connected to the monitor mode interface on the master unit by using a cable 5 4 1 Microcontroller Unit MCU 5 4 2 DALI Interface The MCU used in this design as in the master unit is the 68 908 8 An LED D1 is directly connected t
46. D CHARACTER READ TRIM VALUE FROM FLASH EXIT SHORTED x VALUE TO FLASH 0x55 ON SCI Y a YES INCREASE TRIM SIGNAL VALUE NO m Y DALI YES WRITE TRIM EXIT Figure 3 11 cpu Init Flowchart Digitally Addressable Lighting Interface DALI Unit 40 DALI Master Unit MOTOROLA 3 5 3 DALI Module 3 5 4 Keys Module DALI Master Unit Upgrading the Software The DALI communication is handled in the DALI module Several parts ofthe processor are used Incoming data is detected by an IRQ interrupt Then this data is sampled with an interval 4800 times per second set by the timebase module TBM The timebase module also controls the transmission If data is to be repeated this is handled in the DALI module The keys module detects changes to the shaft encoders or the use ofthe push button The push button is simply handled by the keyboard interrupt module This is not possible with the shaft encoders since it is impossible to determine which of the shaft encoders were rotated using only one common interrupt The need for more interrupt sources is solved by enabling the input capture capability of the timer interface module TIM 3 5 5 Liquid Crystal Display LCD Module 3 5 6 RS232 Module The LCD is controlled through the driver circuit by the LCD module The data is clocked into the shift register of the driver circ
47. DR GROUP_8_15 amp 1 lt lt command amp 0x0F 8 break case QUERY SCENE LEVEL answer SCENE 0 15 ADDR command amp 0x0F flag SEND ANSWER break default break Initialization void lamp Init void Reset values that are not stored in flash power_failure TRUE This is true until certain commands has arrived limit_error FALSE No error dtr 0 level 0 search_address_h OxFF search_address_m OxFF search address 1 OxFF Initialize flash values if necessary if POWER ON LEVEL 255 Check if flash has been written Write factory information into flash lamp WriteFlash SHORT ADDRESS ADDR 255 No short address lamp_ResetFlash repeat_time 0 Initialize when starting address_time 0 Initialize when starting Start timer for initial lamp values state_time 30 600 ms Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 151 DALI Slave Source Code Files state_no INIT_STATI Gl Initialize the timer interface module TSC 0x76 Stop and reset counter Set prescaler to internal bus 64 Enable timer overflow interrupt TMOD 0x0600 Period 50 Hz Initialize channel 0 for PWM TCHO 0 0000 Clear channel 0 compare register last_channel 0 0x3A Set channel 0
48. Files Slave lamp c case STORE THE DTR AS MAX LEVEL if dtr MIN LEVEL amp amp dtr lt 254 lamp_WriteFlash MAX_LEVEL_ADDR dtr break case STORE THE DTR AS MIN LEVEL if dtr PHYSICAL MIN LEVEL amp amp dtr MAX LEVEL I lamp WriteFlash MIN LEVEL ADDR dtr break case STORE THE DTR AS SYSTEM FAILURE LEVEL lamp WriteFlash MIN LEVEL ADDR dtr break case STORE THE DTR AS POWER ON LEVEL if dtr 1 amp amp dtr lt 254 lamp WriteFlash MIN LEVEL ADDR dtr break case STORE THE DTR AS FADE TIME lamp WriteFlash FADE TIME ADDR dtr amp 0 0 break case STORE THE DTR AS FADE RATE if dtr lamp WriteFlash FADE RATE ADDR dtr amp 0 0 break case STORE DTR AS SHORT ADDRESS if dtr 255 lamp WriteFlash SHORT ADDRESS ADDR 255 else if dtr amp Ox7E gt gt 1 lt 63 lamp WriteFlash SHORT ADDRESS ADDR dtr amp 0 7 gt gt 1 break case QUERY_STATUS answer 0x00 if lamp TestFailure TRUE answer 0x02 if level answer 0x04 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOT
49. IOS 53 Freue BUSE BOR Lio cp odo CR C GR 54 Monitor Mode Interface 54 55 The ON PUN MT 55 Man ee 56 Central Processor Unit CPU Module 57 iT Bp m 57 Lamp NODE L4 doi duos Pod OE dede 57 RS232 POGUE Ls ua ach KR ERR ded E OREL ERE OUR 59 Upgrading the Software 60 Board COMMISH RRsERR RS Ad 60 Reprogramming the Code 60 This section describes the design of the DALI Digital Addressable Lighting Interface slave unit hardware and the software The DALI slave unit receives DALI commands from a DALI master unit through a DALI interface These commands tell the DALI slave unit how to control a connected lamp Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit 49 DALI Slave Unit 5 3 Features The DALI slave unit is designed to be as small and simple as possible It has the following features e AMC68HC908KX8 A polarity insensitive DALI interface e power switch for controlling a 12 V 10 W lamp Acurrent sensor for controlling the lamp status 5 4 Hardware The hardware consists of a power MOSFET the CPU 68 908 8 and a DALI interface A low ohm resistor is used to sense the current through the connected lamp by using the analog to digital A
50. Interface DALI Unit 12 Table of Contents MOTOROLA Table of Contents GB COIs dpa Ee GOR es hehe his 130 G 9 BUE INE DE aea 3d 4 9 hor ADD e Ee ded dae dr ri a 131 G10 Slave lamp 134 G11 BUE BRE ay apus p Rd REOR dee ee papa a 135 G12 Save IAS 6 gie dodo OR dor Cap Pe OI d CR HC ann 156 G13 SHNS 23A MONTI 158 G SEE Pm 159 G 15 heehee rs 161 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA Table of Contents 13 5 DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 14 Table of Contents MOTOROLA Designer Reference Manual DALI Unit Figure Title 1 1 The DALI Bus System 2 1 The DALI Demonstration Board 2 2 The LCD Display 3 1 DALI Master Unit 3 2 DALI Transmit Circuit 3 3 DALI Receive 3 4 Keyboard Interface 3 5 LCDInterface 3 6 RS232Interface 3 7 Monitor Mode Interface 3 8 PowerSupply 3 9 DALI Master Software 3 10 main Flowchart 3 11 cpu Init Flowchart 4 1 DALI Master Message 4 2 DALISlave Message 5 1 Slave 5 2 LED Interface 5 3 DALI Transmit Circuit
51. Interface DALI Unit DRM004 Rev 3 0 MOTOROLA Table of Contents 11 Table of Contents Appendix F DALI Master Unit Source Code Files DRM004 Rev 3 0 F 1 F 2 F 3 F 4 F 5 F 6 F7 F 8 F 9 F 10 F 11 F 13 F 14 ES F 16 G 1 G 2 G 3 G 4 3 5 G 6 G 7 ool m 85 86 Master COLA yz y ya tan eRe kayu asus 88 Master CPUC ck og us asss EE sb Oe Ee ETE pb 89 Master dalli 92 OE Lu uy on desea d d Job Ue dede drap dedi odii 93 cc NI 654d tks Stee 99 Master 0 8 100 Master 103 Master KEYS e 104 Master d eo RR COR Rei oe diio dede od op d OE REC 106 Master DD ordo e OR CERE For Fed dos d ob aO C deed 107 Master NGS ua chase cere hee ee kee bap Go eap OR OR ees 110 Master 5232 112 Mastar Ve ee eee 113 Master vector C 115 Appendix G DALI Slave Source Code Files ee ee cr 117 Slave command D aua d ee oe 118 SV AY 3 ch a be da 120 RR RTL COR SCR 7 121 cic wor EM m 122 ed niyaq OU Plc CE 124 add redde 125 Digitally Addressable Lighting
52. LI Unit 116 DALI Master Unit Source Code Files MOTOROLA Designer Reference Manual DALI Unit G 1 Contents Appendix G DALI Slave Source Code Files G2 Giave cd 118 G3 Slavei COI uu dedi aceti wasa e aia ca ER 120 GA OWT di dud nud m edad S d d dud 121 GS ek diae iuda Cabo iu eai P t a t 122 GG BEDS SNL sd Rd d pol eda dba ea 124 CHER 4 kes rrr 125 Se DEBE Re 130 G9 C PERPETUO rr 131 G10 Slave PTT 134 G J Pr wv 135 BEBE WS 5 25 dins Bead A S RR REESE Ra d 156 Gave 22 158 G14 Glave oca PPP 159 312 BEND VOGO do uu Sca uu dcus d wau a e vacca dca e Rd d 161 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 117 DALI Slave Source Code Files G 2 Slave command h command h hs This header contains DALI command definitions Prepared Motorola AB Functional level Application Revision R1A Rev Date Reason description P1A 001216 Initial version RIA 010212 Released version ifndef COMMAND define COMMAND Indirect arc power control commands define OFF 0x00 define UP 0 01 define DOWN 0x02 define STEP_UP 0x03 define STEP_DOWN 0x04 de
53. LIMIT ERROR 0x94 define QUERY RESET STATE 0x95 define QUERY MISSING SHORT ADDRESS 0x96 define QUERY VERSION NUMBER 0x97 define QUERY CONTENT DTR 0x98 define QUERY DEVICE TYPE 0x99 define QUERY PHYSICAL MINIMUM LEVEL Ox9A define QUERY_POWER_FAILURE 0 9 Queries related to power parameters settings define QUERY ACTUAL LEVEL 0 0 define QUERY LEVEL 1 define QUERY_MIN_LEVEL 0 2 define QUERY_POWER_ON_LEVE define QUERY SYSTEM FAILURE LEVEL OxA4 define QUERY_FADE 0 5 Queries related to system parameters settings define QUERY_SCENE_LEVEL OxBO define QUERY GROUPS 0 7 0xC0 define QUERY_GROUPS_8_15 1 define QUERY_RANDOM_ADDRESS_H 0xC2 define QUERY_RANDOM_ADDRESS_M 0xC3 define QUERY_RANDOM_ADDRESS_L 0xC4 Terminate special processes define TERMINATE OxA1 Es Download information to the dtr define DATA TRANSFER REGISTER 0xA3 Addressing commands define INITIALISE 5 define RANDOMISE OxA7 define COMPARE OxA9 define WITHDRAW OxAB define SEARCHADDRH 1 define SEARCHADDRM 0xB3 define SEARCHADDRL OxB5 define PROGRAM SHORT ADDRESS 0xB7 define VERIFY SHORT ADDRESS OxB9 define QUERY SHORT ADDRESS OxBB define PHYSICAL SELECTION OxBD dendif Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI
54. MAX LEVEL ADDR unsigned char OxFD83 Maximum level address define FADE RATE ADDR unsigned char OxFD84 Fade rate address define FADE TIME ADDR unsigned char OxFD85 Fade time address define SHORT ADDRESS ADDR unsigned char OxFD86 Short address address define RANDOM ADDRESS H ADDR unsigned char OxFD87 Random address high address define RANDOM ADDRESS M ADDR unsigned char OxFD88 Random address middle address define RANDOM ADDRESS L ADDR unsigned char OxFD89 Random address low address define GROUP 0 7 ADDR unsigned char OxFD8A Group 0 7 address define GROUP 8 15 ADDR unsigned char 0xFD8B Group 8 15 address define SCENE 0 15 ADDR unsigned char OxFD8C Scene level array 0 15 address Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 135 DALI Slave Source Code Files define POWER_ON_LEVEL POWER_ON_LEVEL_ADDR Power on level define SYSTEM FAILURE LEVEL SYSTEM FAILURE LEVEL ADDR System failure level define MIN_LEVEL MIN_LEVEL_ADDR Minimum level define MAX_LEVEL MAX_LEVEL_ADDR Maximum level define FADE_RATE FADE_RATE_ADDR Fade rate define FADE_TIME FADE_TIME_ADD
55. N to return to normal mode 3 6 2 Monitor Mode Software There is freely available software for the PC environment that cares about the most common tasks during the monitor mode The program PROGOS8SZ from P amp E Microcomputer Systems Inc http www pemicro com will work fine if the main task is to download new software to the DALI modules With that software you define the DALI unit as a Class board The monitor mode interface is prepared for a communication speed at 9600 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 42 DALI Master Unit MOTOROLA DALI Master Unit Upgrading the Software 3 6 3 Replacing the Code By using monitor mode software the FLASH memory ofthe DALI master unit can be erased and new software downloaded After a successful replacement of the code the internal clock has to be trimmed The internal clock generator of the processor has a tolerance of 25 This can be trimmed down to 2 In the process of loading new software the trim values are corrupted Since the system is dependent on correct communication speed a trimming has to take place before the code can be executed properly This is done through the RS232 interface the DALI interface and by using an oscilloscope Connect the computer to the D sub on the DALI master unit marked Serial Connect a cable between JP4 and JP5 see Appendix DALI Master Unit Schematic and Layout e Connect th
56. O92 Motorola ON QG1 IQXO 350C 9 8304 MHz Clock oscillator DIP14 IQD D1 BYV10 30 Schottky diode SOD81 Philips D2 BZX55 C10 Zener diode DO35 Temic D3 BZX55 C8V2 Zener diode DO35 Temic 1 BD135 Power transistor TO125 Motorola ON T2 BC337 Transistor TO92 Philips T3 BC337 Transistor TO92 Philips DIS1 SP505PR LCD DIP40 Seiko R1 2 7 0 6 W Resistor Spacing 10 mm R2 1 kO 0 6 W Resistor Spacing 10 mm Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Master Unit Bill of Materials 75 DALI Master Unit Bill of Materials Table C 1 DALI Master Bill of Materials Sheet 2 of 3 Id Type Description Package Supplier R3 10 kQ 0 6 W Resistor Spacing 10 mm R4 390 Q 0 6 W Resistor Spacing 10 mm R5 1 0 6 W Resistor Spacing 10 mm R6 47 0 6 W Resistor Spacing 10 mm R7 10 kO 0 6 W Resistor Spacing 10 mm R8 10 kO 0 6 W Resistor Spacing 10 mm R9 1 0 6 W Resistor Spacing 10 mm R10 10 kO 0 6 W Resistor Spacing 10 mm R11 10 kO 0 6 W Resistor Spacing 10 mm R12 10 kO 0 6 W Resistor Spacing 10 mm R13 10 kO 0 6 W Resistor Spacing 10 mm R14 10 kO 0 6 W Resistor Spacing 10 mm R15 10 kO 0 6 W Resistor Spacing 10 mm R16 10 kO 0 6 W Resistor Spacing 10 mm R17 1 0 6 W Resistor Spacing 10 mm C1 Ceramic 0 33 uF 63 V Capacitor Spacing 5 mm C2 Ceramic 0 1 uF 63 V Capacitor
57. OROLA DALI Slave Source Code Files 147 DALI Slave Source Code Files if limit_error TRU Gl answer 0x08 if state no FADE STATE answer 0x10 if state_no INIT_STAT Gl answer 0x20 if SHORT ADDRESS 255 answer 0x40 if power failure TRU answer 0x80 flag SEND_ANSWER break case QUERY BALLAST answer OxFF YES flag SEND_ANSWER break case QUERY LAMP FAILURE if lamp TestFailure TRUE Gl answer OxFF YES flag SEND_ANSWER break case QUERY LAMP POWER ON if level answer OxFF Y Gl flag SEND_ANSWER break case QUERY LIMIT ERROR if limit error TRU Gl answer OxFF Y flag SEND ANSWER break case QUERY_RESET_STATE if state_no INIT_STAT Gl answer OxFF Y DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 148 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c flag SEND_ANSWER break case QUERY_MISSING_SHORT_ADDRESS if SHORT_ADDRESS 255 answer OxFF Y flag SEND_ANSWER Gl break case QUERY VERSION NUMBER answer VERSION NUMBER I
58. R Fade time define SHORT_ADDRESS SHORT_ADDRESS_ADDR Short address define RANDOM_ADDRESS_H RANDOM_ADDRESS_H_ADDR Random address high define RANDOM ADDRESS M RANDOM ADDRESS M ADDR Random address middle define RANDOM ADDRESS L RANDOM ADDRESS L ADDR Random address low define GROUP 0 7 GROUP 0 7 ADDR Group 0 7 fdefine GROUP 8 15 GROUP 8 15 ADDR Group 8 15 Permanent data definitions define VERSION NUMBER 0x00 The current version number 0 0 define PHYSICAL MIN LEVEL 0x01 The physically lowest possible level Definition for the timer states define IDLE STATE 0x00 No change define INIT STATE 0x01 State during the first 600 ms or until the first data arrives define FADE STATE 0x02 During this state the lamp is changing to a new level Table containing conversions between light level values and logarithmic dimming level static const unsigned int log level 253 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0002 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0003 0x0004 0x0004 0x0004 0x0004 0x0004 0x0004 0x0004 0x0004 0x0004 0x0005 0x0005 0x0005 0x0005 0x0005 0x0005 0x0005 0x0006 0x0006 0x0006 0x0006 0x0006 0x0006 0x0007 0x0007 0x0007 0x0007 0x0007 0x0007 0x0008 0x0008 0x0008 0x0008 0
59. S M ADDR START OF FLASH BUFFER OxFF unsigned char RANDOM ADDRESS L ADDR START OF FLASH BUFFER OxFF unsigned char GROUP O0 7 ADDR START OF FLASH BUFFER 0x00 unsigned char GROUP 8 15 ADDR START OF FLASH BUFFER 0x00 for index 0 index 16 1 unsigned char SCENE_0_15_ADDR START_OF_FLASH_BUFFERt index 255 di Disable all interrupts during flash erase and flash write Place erase start address in H X and call the erase routine flash_erase Place write start address in H X and call the write routine flash_write ei Enable all interrupts Set the light level static void lamp_SetLevel unsigned char wanted_level unsigned char new_level limit_error FALSE new_level wanted_level if new_level gt 1 amp amp new_level lt 254 if new_level lt MIN_LEVEL new level MIN LEVEL limit error TRUE if new_level gt MAX_LEVEL new level MAX LEVEL limit error TRUE Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 139 DALI Slave Source Code Files Test if lamp is functional if new_level 0 if last_channel 0 TCH1 0 0000 last_channel 1 else TCHO 0x0000 last_channel 0 TSCO amp 0 01 level new_level if new_level gt 1 amp amp new_
60. SWER EVENT flag amp ANSWER EVENT lcd ShowAnswer rs232 SendAnswer NT flag can be set ERROR EVE if flag amp ERROR EVENT flag amp ERROR EVENT lcd ShowError Digitally Addressable Lighting Interface DALI Unit Clear SEND_DATA flag ENT flag can be set from the dali module Clear ANSWER_EVENT flag Update the lcd with the answer Send the answer on the rs232 port from any module Clear ERROR_EVENT flag Update the lcd with the error code DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 111 DALI Master Unit Source Code Files F 1 14 Master rs232 h rs232 H This header contains definitions for the rs232 module Prepared Motorola AB Functional level Hardware Revision R1A Rev Date Reason description PIA 001027 Initial version 010212 Released version fndef RS232 define RS232 ex ex ex de DRM004 Rev 3 0 Initialize tern void rs232 Init void Sends the DALI answer on the rs232 port tern void rs232 SendAnswer void Interrupt handler for received data on the rs232 port tern interrupt void rs232 ReceiveData void ndif Digitally Addressable Lighting Interface DALI Unit 112 DALI Master Unit Source Cod
61. TH BUFFER DISABLE INTERRUPTS ERASE FLASH DATA AREA WRITE BUFFER DATA FLASH ENABLE INTERRUPTS Figure 5 11 lamp WriteFlash Flowchart For more information regarding the on chip routines refer to the Motorola Application Note entitled Using MC68HC908 On Chip FLASH Programming Routines Motorola order number AN1831 D 5 5 5 RS232 Module The RS232 module is similar to the module for the master unit The difference is that other flags are set Messages received over RS232 by a master are forwarded over the DALI communication line but on a slave the messages are handled directly as if they had arrived over the DALI net Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit 59 DALI Slave Unit 5 6 Upgrading the Software Reprogramming the software in the DALI slave unit is done in a similar way as in the DALI master unit Refer to 3 6 Upgrading the Software for more information The main difference is that the DALI slave unit does not have a complete monitor mode interface Therefore to enter the monitor mode the slave unit has to use the monitor mode interface on the master unit 5 6 1 Board Configuration To configure the board in monitor mode e Disconnect the power supply and connect a free serial communication port of the PC or the computer that communicates with the processor to the D sub on the DALI master unit
62. __memory bss tdef stack 0xOFF DRM004 Rev 3 0 vectors start address interrupt vectors symbol used by library stack pointer value Digitally Addressable Lighting Interface DALI Unit 130 DALI Slave Source Code Files MOTOROLA G 9 Slave iokx8 h IO DEFINITIONS FOR 68 908 8 Copyright c 2000 by Motorola AB Based on definition from Cosmic dA define uint unsigned int PORTS section x tiny volatile char PTA 80 00 tiny volatile char 80 01 tiny volatile char DDRA 0 04 tiny volatile char DDRB 0 05 tiny volatile char 0x0d SCI section x tiny volatile char 5 1 80x13 tiny volatile char SCC2 80 14 tiny volatile char SCC3 0 15 tiny volatile char 5 51 80 16 tiny volatile char 5 52 0 17 tiny volatile char SCDR 0 18 tiny volatile char SCBR 0 19 KEYBOARD section tiny volatile char KBSCR 0 1 keyboard status control register tiny volatile char KBIFR 0 15 section x tiny volatile char TBCR 0 1 IRQ section tiny volatile char ISCR 0 1 CONFIG section x tiny volatile char CONFIG1 0 1 tiny volatile char CONFIG2 0 1 TIMER section AY Digitally Addressable Lighting Interface DALI Unit DALI Slave Source Code File
63. a array to be written into flash define flash erase _asm ldhx SFD80 njsr 1006 n define flash_write asm ldhx SFD80 njsr 1009 n define clock_write _asm ldhx S FDFF njsr 1009 n endif DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 120 DALI Slave Source Code Files MOTOROLA G 4 Slave cpu h cpu h This header contains definitions for the cpu module Prepared Motorola AB Functional level Hardware Revision R1A Rev Date Reason description 1 001023 Initial version 010212 Released version ifndef CPU define CPU ex ex Initialize tern void cpu_Init void Interrupt handler for reset tern interrupt void _stext void Trap lost interupts tern interrupt void cpu_Trap void fendif Digitally Addressable Lighting Interface DALI Unit DALI Slave Source Code Files Slave cpu h DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 121 DALI Slave Source Code Files G 5 Slave cpu c cpu c This module handles all cpu related tasks Prepared Motorola AB Functional level Hardware Revision 1 Rev Date Reason description P1A 001023 Initial version PIB 000201 Added automatic clock calibration RIA 010212 Released version RIB 011016 Adapted to new clock speed incl
64. an be selected By pressing the button Set the new setting will be communicated to the DALI slaves through the DALI master Selecting another scene makes it possible to store 16 settings 6 5 The Source Code The DALI demo application is developed using Visual Basic 6 0 It consists of a single Visual Basic Form File Main Each action by the user results in a series of DALI messages See Table 6 1 Table 6 1 DALI Messages Used in the DALI Demo Application Action Messages Values Answer Initialization Ask status XX 90 XX short address LL LL status Store data in DTR A3 WW WW fade time Store DTR as fade time XX 2E XX short address Set new Set light level XX YY YY light level Move light level to DTR FF 21 Save DTR as scene FF 47 Z scene Select scene FF 17 Z scene Change scene Ask fade time XX A5 XX short address MM MM fade time Ask light level XX AO NN NN light level Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA PC Software 65 PC Software DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 66 PC Software MOTOROLA Designer Reference Manual DALI Unit Appendix A DALI Instruction Set The DALI Digital Addressable Lighting Interface protocol specifies a number of commands that a DALI unit should recognize They consist of two bytes where normally the first byte indicates the
65. as XX XX 9B Check if the slave is in power failure mode YES NO AO Returns the current light level as XX XX Al Returns the maximum allowed light level as XX XX 2 Returns the minimum allowed light level as XX A3 Return the power up level as XX XX A4 Returns the system failure level as XX XX 5 Returns the fade time as X and the fade rate Y BO0 Scene Returns the light level XX for the selected scene XX CO Returns a bit pattern XX indicating which group 0 7 the slave belongs to XX C1 Returns a bit pattern XX indicating which group 8 15 the slave belongs to XX C2 Returns the high bits of the random address as HH HH C3 Return the middle bit of the random address as MM MM Returns the lower bits of the random address as LL LL Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Instruction Set 69 DALI Instruction Set Table A 2 Special Commands ana Description Answer Al 00 All special mode processes shall be terminated Store value XX in the DTR 5 Initialize addressing commands for slaves with address 7 00 Generate new random address 9 00 Compare the random address with the search address B AB 00 Withdraw from the compare process B HH Store value HH as the high bits of the search address Store value as the middle bits of the search address B5 LL Sto
66. asua aq 88 3 H rrr 89 pns Manor BE u Ede iru 92 cle sasam aga 93 99 Re gt os 55554425 100 RS keya oak e tome maqa ata 103 FIO Master kau sqa a maa 104 o PPP 106 FIZ Mano TL 107 F13 110 Bal TREE D RAP ARRA 112 uoa da wn buda a da 113 EIS Mas 22 ad 115 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 DALI Master Unit Source Code Files 85 F 2 Master common h common h DALI Master Unit Source Code Files This header contains common definitions Prepared Motorola AB Functional level Common Revision RIA Rev Date Reason description PIA 001023 Initial version P1B 010201 Added declaration for embedded ROM flash routines RIA 010212 Released version ifndef COMMON define COMMON define TRUE 1 define FALSE 0 Global definit ion extern unsigned c extern unsigned c extern unsigned c extern unsigned c define SRSR_ERRO har address har command answer har error R 0x01 extern unsigned int flag define N define S W_DATA ND_DATA 0x01 0x02 define ERROR_EVENT 0x04 ENT 0x08 define ANSWER_EV define DEMO_MODE
67. dress and the command according to Table 2 1 using the shaft encoders and push button Table 2 1 Examples of DALI Commands Address Command Action Set the light level to E6 approximately 50 FE E6 on all lamps 02 FE Set lamp 3 to 100 light level FF 01 Dim up all lamps for 200 ms 01 00 Turn off lamp 1 07 92 Check if lamp 4 is working No answer means YES A FF means NO DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 26 DALI Demonstration Board MOTOROLA Designer Reference Manual DALI Unit 3 1 Contents Section 3 DALI Master Unit MOTOROLA ac 28 0 gt td pu almaq saka 28 29 3 4 1 Microcontroller Unit MCU 30 3 4 2 DALININ aedi Ed 31 3 4 3 Keyboard Interface 33 3 4 4 The LOD u y ence OO ONS ee 33 3 4 5 The RS232 Interface 34 3 4 6 Monitor Mode Interface 35 3 4 7 Power SUDDIY d RR ree ara do 36 TIN GINE osea epo wee oA ioo e eb caedis 36 3 5 1 Mam ae ereraa e RC EER 37 3 5 2 Central Processor Unit CPU Module 39 3 5 3 Ges a ae ae qal RR RR d 41 3 5 4 Keys Mod le d ERES 41 3 5 5 Liquid Crystal Display LCD Modu
68. dressable Lighting Interface DALI Unit 124 DALI Slave Source Code Files MOTOROLA G 7 Slave dali c DALI Slave Source Code Files Slave dali c dali c This module handles all tasks related to the dali port Prepared Motorola AB Functional level Hardware Revision 1 Rev Date Reason description P1A 001110 Initial version RIA 010212 Released version RIB 011010 Adapted to new clock speed Reception improved to be more tolerant The timebase module TBM is used include common h include iokx8 h static unsigned char send_position Position in the data to transfer static unsigned char send_active True if transfer has started static unsigned char send_value Holds the logic level to transfer static unsigned char rec_position Position in the data to receive static unsigned char rec_active True if reception has started static unsigned char rec_value Holds the received logic level static unsigned char rec_bit Number of received bits static unsigned int low_counter Number of ticks the signal level has been low Initialize void dali_Init void send_active FALSE rec_active FALSE Interrupt 9600 times second ISCR 0 04 Enable interrupt Sends the DALI address and command on the dali port void dali_SendAnswer void Check if some co
69. dware The DALI interface has one circuit for transmitting see Figure 3 2 and one circuit for receiving see Figure 3 3 The transmission consists mainly of a powertransistor T1 for switching the power on and off The powertransistor is regulated by two transistors T2 and T3 One of the two transistors T3 is controlled from the processor PTB7 through an inverter 4 A low signal from the processor gives a high signal after the inverter This high signal opens the transistor T3 which switches off the power transistor T1 A high signal from the processor gives a low signal after the inverter closing the transistor T3 and switching on the power transistor T1 The other transistor T2 is controlled by the current flowing through the resistor R1 If a DALI slave unit is connected this current will be the same as that flowing through the power transistor The value of the resistor is chosen in such a way that when the current exceeds 250 mA the voltage level across the resistor will open the transistor T2 which in its turn closes the power transistor T1 In this way the current is maximized to 250 mA 12V DALI R1 PTB7 gt 4 lli if 0v 0v 0v Figure 3 2 DALI Transmit Circuit Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 31 DALI Master Unit NOTE DRM004 Rev 3 0 The comparator IC3 handles t
70. e Files MOTOROLA DALI Master Unit Source Code Files Master rs232 c F 15 Master rs232 c rs232 c fh This module handles all tasks related to the rs232 port Prepared Motorola AB Functional level Hardware Revision 1 Rev Date Reason description PIA 001027 Initial version RIA 010212 Released version RIB 011016 Adapted to new clock speed The serial communication interface module SCI is used include common h include iokx8 h static unsigned char first Keeps track if incoming data is address or command Initialize void rs232 Init void SCBR 0x05 Baud rate 9600 SCC1 0x40 Enable SCI SCC2 0x2C Enable receive interrupt transmitter enabled receiver enabled first TRU Gl Next incoming byte is an address Sends the answer on the rs232 port void rs232_SendAnswer void while 5 51 amp 0 80 0 00 Wait until transmit buffer is empty SCDR answer Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 113 DALI Master Unit Source Code Files Interrupt handler for received data on the rs232 port interrupt void rs232_ReceiveData void if 5 51 amp 0x20 Received data available in SCDR if first TRUE address SCDR first FALSE Next data is a command
71. e connected with a cable See Figure 5 7 12V L PTA1 0 00 PTB6 OSC1 OOOOOO 0v Figure 5 7 Monitor Mode Interface DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 54 DALI Slave Unit MOTOROLA DALI Slave Unit The Software 5 4 6 Power Supply The power supply solution is identical to the one used in the master unit The regulator IC4 is responsible for the 5 volt conversion Incorrect polarity is handled by D2 See Figure 5 8 12V 5V c4 D2 O e O 0v OV Figure 5 8 Power Supply 5 5 The Software The software for the master unit and the slave unit is very similar but they do not share the code although some files have the same name The structure is however identical See Figure 5 9 The source code can be viewed in Appendix G DALI Slave Source Code Files CPU DALI MAIN LAMP RS232 Figure 5 9 DALI Slave Software Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit 55 DALI Slave Unit 5 5 1 Main Module The main module in the slave unit has the same structure as the main module in the master unit If the initialization process is successful toggling an output pin on PTA lights the LED The possibility to source and sink high current on PTA is u
72. e oscilloscope between ground and PTB5 TXD on the DALI unit A PC program that can generate a break signal on the serial communication port is also needed When the system is powered a square wave signal which should be slightly larger than 2400 Hz is visible on the oscilloscope The frequency should be changed until it is between 2385 and 2415 Hz Sending a break signal does this For each break signal the frequency is lowered by about 5 Hz When the correct frequency is achieved the trim value can be stored by making a temporary short circuit across the DALI signal wires The next time the unit is restarted the clock is automatically trimmed and the execution of the program is normal Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 43 DALI Master Unit DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 44 DALI Master Unit MOTOROLA Designer Reference Manual DALI Unit 4 1 Contents 4 2 Introduction Section 4 DALI Protocol Standard ae WUC 45 Electrical Specification 46 4 4 Protocol Specification 46 This section describes the main properties of the DALI Digital Addressable Lighting Interface protocol More information regarding the DALI protocol can be found in the document A C Supplied Electronic Ballast for Tubular Fluorescent Lamps Performance Requirem
73. e slave belongs to 16 bits Light levels for different scenes 16 bytes Status information Holds the current status information regarding the slave Version number The currently implemented DALI protocol version number pus ee The smallest allowed physical arc power level Messages can be sent over the DALI communication wires to change or check the values The serial communication speed is 1200 baud with bi phase encoding All communication is controlled from a master Every lamp is connected to a slave unit that is silent until the master requires an answer A message from a master consists of one start bit 16 bits data and two stop bits The data from the master unit consists of an 8 bit address part and an 8 bit command part See Figure 4 1 ADDRESS BYTE COMMAND BYTE 5 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 5 5 STARTBIT STOP BITS Figure 4 1 DALI Master Message Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Protocol Standard 47 DALI Protocol Standard An answer from a slave unit consists of 1 start bit 8 data bits and 2 stop bits RESPONSE BYTE 5 7 6 5 4 3 2 1 0 5 5 V START BIT i STOP BITS Figure 4 2 DALI Slave Message Up to 64 slaves can be connected to the same network and each slave can receive an individual address
74. egister FLASH control register FLASH block protect register Digitally Addressable Lighting Interface DALI Unit 132 DALI Slave Source Code Files MOTOROLA BREAK section near volatile char BRKAR near volatile uint BRK near volatile char BRKH near volatile char BRKL near volatile char BRKSCR LVI section near volatile char LVISR COP section near volatile char COPCTL undef uint 80 02 0 09 0 09 Oxfe0a O0xfe0b 0 0 Digitally Addressable Lighting Interface DALI Unit BRI BRI BRI BRI BRI DALI Slave Source Code Files Slave iokx8 h auxiliary register address register address register low address register high status ctrl register LVI status register COP control register DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 133 DALI Slave Source Code Files G 10 Slave lamp h ifndef define lamp h This header contains definitions for the lamp module Prepared Motorola AB Functional level Hardware Revisio Rev PIA RIA Da 01 n RIA te Reason description 001215 Initial version 0212 Released version LAMP LAMP Initialization ex ex ex ex fendif DRM004 Rev 3 0 tern void lamp Init
75. end active FALSE if repeat active TRUE flag SEND DATA send_position flag amp DEMO_MOD demo tick t Change scene after 3 seconds if demo_tick 28800 demo_tick 0 demo_scenett if demo_scene gt 15 demo_scene 0 address BROADCAST command GO_TO_SCENE demo_scene flag NEW_DATA SEND_DATA Digitally Addressable Lighting Interface DALI Unit 98 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master F 7 Master dali lkf LINK COMMAND FILE Example for 68HC908KX8 Copyright c 2000 by Motorola AB seg text b 0 000 mOx1E00 nCODE sROM program start address seg const a CODE it sROM constants and strings seg bsct b 0x40 0 0 nZPAGE 5 zero page start address 5 ubsct a ZPAGE nUZPAGE sRAM seg data a UZPAGE nIDATA sRAM data start address seg bss a nUDATA sRAM CDS ro startup routine main o application program lcd o cpu o keys o 5232 0 dali o C NCOSMICNEVALO8NLibNlibi h08 C NCOSMICNEVALO8NLibNlibm h08 seg const b OxFFDC vectors start address vector o interrupt vectors tdef __memory bss symbol used by library tdef __stack 0x0FF stack pointer value Digitally Addressable Lighting Interface DALI Unit DRMO004
76. ent Requirements for Controllable Ballasts which can be obtained from IEC Some major characteristics of the DALI protocol are e Asynchronous serial protocol e 1200 baud bi phase encoding half duplex Two wire differential Voltage difference above 9 5 V means high level Voltage difference below 6 5 means low level The master unit controls the communication e 64slave units can be connected Each slave unit can be individually addressed The master unit sends 1 start bit 16 bit data and two stop bits The slave unit sends 1 start bit 8 bit data and two stop bits Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Protocol Standard 45 DALI Protocol Standard 4 3 Electrical Specification The DALI communication is serial using two wires for communicating in both directions The voltage difference between the wires indicates if it is a high or low level A voltage difference above 9 5 V is a high level and a voltage difference less than 6 5 V is a low level The master unit communicates with the slave units by setting the level high or low according to the serial protocol described in 4 4 Protocol Specification When no communication takes place the master unit keeps the level high The slave unit responds to the master unit by setting the level high or low A high level is simply achieved by not interfering with the high level set by the master unit A low level is obtained by
77. er unit and four DALI slave units They are connected through a 2 wire DALI network The master unit controls all the slave units and each slave unit can control a lamp See Figure 2 1 4 SLAVE UNITS Figure 2 1 The DALI Demonstration Board DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 24 DALI Demonstration Board MOTOROLA DALI Demonstration Board System Installation 2 5 System Installation The system has to be powered from an external source The requirement for this supply is 12 V 10 14 V DC The power consumption is dependent on the number and size of the connected lamps The master and slave boards without the lamps connected consume less then 500 mA Use any 12 V lamps with a power consumption equal to or less than 10 W A 12 V 10 W halogen light bulb would be a good choice The power supply has to be dimensioned according to this Mascot 9120 12 is sufficient for this purpose but several other power supplies that meet the above criteria can be used Connect the lamps to the 2 way Phoenix screw terminal for each slave unit and connect the power supply to the terminal socket 12 V to red cable and 0 V to black cable 2 6 System Operation After connecting the power supply the system starts in its default mode Every slave unit should light its connected lamp and the LED should be lit showing that the slave unit is run
78. errupt void keys CommandPulse void Interrupt handler for address pulse sender extern interrupt void keys AddressPulse void endif Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 103 DALI Master Unit Source Code Files F 10 Master keys c keys c This module handles all tasks related to the keys Prepared Motorola AB FI Functional level Hardware Revision RIA Rev Date Reason description P1A 001025 Initial version RIA 010212 Released version The keyboard interrupt module KBI and the timer interface module TIM are used include common h include iokx8 h Initialize void keys_Init void Keyboard Interrupt Module KBIER 0x01 Interrupt enabled on PTAO KBSCR 0x04 Interrupt request not masked Clear interrupt request Falling edges sensitivity Timer Interface Module TSC 0x00 Start timer only interrupts are used not the captured values TSCO 0x48 Interrupt enabled Input capture on falling edge 0 48 Interrupt enabled Input capture on falling edge Interrupt handler for send button interrupt void keys_SendButton void flag SEND DATA flag amp DEMO MODE Clear demo mode Interrupt handler for command pulse sender interrupt void keys CommandPulse void
79. es Master dali c Reception improved to Dbe more tolerant Broadcast address for the DALI network changing scene starting the demo mode not starting initialization mode generating a random address Position in the data to transfer True if transfer has started Holds the logic level to transfer Position in the data to receive True if reception has started Holds the received logic level current scen Number of ticks since last scene change dali c This module handles all tasks related to the dali port Prepared Motorola AB Functional level Hardware Revision Rev Date Reason description P1A 001110 Initial version RIA 010212 Released version 1 011010 Adapted to new clock speed The timebase module TBM is used include common h include iokx8 h Address define BROADCAST OxFF Normal commands define GO_TO_SCENE 0x10 Command for define DEMO OxFF Command for included in the DALI standard Special commands define INITIALISE 0xA5 Command for define RANDOMISE 0xA7 Command for static unsigned char send position static unsigned char send active static unsigned char send value static unsigned char rec position static unsigned char rec active static unsigned char value static unsigned char rec bit Number of received bits static unsigned char demo scene Ho
80. fine RECALL MAX LEVEL 0x05 define RECALL MIN LEVEL 0x06 define STEP DOWN AND OF 0x07 define ON AND STEP UP 0x08 define GO TO SCENE 0x10 General configuration commands define RESET 0x20 define STORE ACTUAL LEVEL IN THE DTR 0x21 Arc power parameters settings define STORE THE DTR AS MAX LEVEL Ox2A define STORE THE DTR AS MIN LEVEL Ox2B define STORE THE DTR AS SYSTEM FAILURE LEVEL 0x2C define STORE THE DTR AS POWER ON LEVEL 0x2D define STORE THE DTR AS FADE TIME Ox2E define STORE THE DTR AS FADE RATE Ox2F define STORE THE DTR AS SCENE 0x40 System parameters settings define REMOVE FROM SCENE 0x50 define ADD TO GROUP 0x60 define REMOVE FROM GROUP 0x70 define STORE DTR AS SHORT ADDRESS 0x80 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 118 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave command h Queries related to status information define QUERY_STATUS 0x90 define QUERY_BALLAST 0 91 define QUERY_LAMP_FAILURE 0x92 define QUERY LAMP POWER ON 0x93 define QUERY
81. forcing a short circuit across the wires This is possible to do since the DALI standard states that the current supply for the DALI communication has to be limited to 250 mA Simultaneous communication is not possible since there is only one pair of wires 4 4 Protocol Specification DRM004 Rev 3 0 There are a number of parameters stored in each slave unit see Table 4 1 These parameters indicate how the lamp should behave in different situations Table 4 1 Description of Stored Parameters Type of Parameter Description Actual dim level cond re level of the lamp or physically the arc Power on level The light level to use when powering up the slave System failure level The light level to use if the communication fails Minimum level The minimum allowed light level Maximum level The maximum allowed light level Digitally Addressable Lighting Interface DALI Unit 46 DALI Protocol Standard MOTOROLA DALI Protocol Standard Protocol Specification Table 4 1 Description of Stored Parameters Continued Type of Parameter Description Fade rate The speed to change the light level during a certain time interval Fade time The time between the change of light levels Short address The individual address of a unit Search address An address used during address initialization Random address An address used during address initialization A value indicating which group th
82. he lights and increasing the lighting according to requirements Digitally Addressable Lighting Interface DALI Unit 20 General Description MOTOROLA General Description Introduction to DALI Properly adjusted light settings depending on the direction of the daylight e g in the morning at noon in the afternoon Energy savings The DALI installation is based on the master slave principle The user operates the system through the controller master The controller sends messages to all the ECGs slaves containing an address and a command The address determines whether the ECG should listen Each ECG is digitally addressed and therefore is insensitive to electromagnetic noise compare with an analogue 1 10 volt system For instance the command could be current brightness value or lamp on or lamp off Lighting values and group assignment will be stored in the ECGs The ECGs may be assigned up to sixteen freely definable groups and each group can store up to sixteen different lighting values for the lighting scenes Each ECG can be assigned to more than one group There may be up to 64 ECGs per each controller Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA General Description 21 General Description DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 22 General Description MOTOROLA Designer Reference Manual DALI Unit
83. he reception and sends the received signal to the processor IRQ1 and PTB6 If very accurate voltage levels are to be achieved the surrounding resistors should be trimmed The inverter 4 converts the signals to the correct logical level RQ1 gt gt i PTB6 _ 4 Figure 3 3 DALI Receive Circuit The interface has no protection against over voltage and no electromagnetic interference EMI suppression Digitally Addressable Lighting Interface DALI Unit 32 DALI Master Unit MOTOROLA DALI Master Unit Hardware 3 4 3 Keyboard Interface The master unit can receive user command through a push button S1 and two shaft encoders S2 and S3 They are connected to the processor PTAO PTAA See Figure 3 4 PTA4 oo PTA3 oo S2 PTA1 oo PTA2 oo 53 OV PTAO 51 d OV Figure 3 4 Keyboard Interface 3 4 4 The LCD Interface The LCD 0151 is controlled by the processor PTBO PTB2 through the LCD driver circuit IC5 See Figure 3 5 PTBO CLOCK DATA PTB2 DIS1 Figure 3 5 LCD Interface Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 33 DALI Master Unit 3 4 5 The RS232 Interface The RS232 interface is connected to the processor 4 and 5 and a pin header JP4 With a cable it can be co
84. hile SCS1 amp 0x80 0x00 Wait until transmit buffer is empty SCDR 0 55 Bit pattern if PTB amp 0x10 0x00 amp amp ser_rec 0x00 ICGTR ser rec PTB amp 0x10 if PTB amp 0x40 0x00 amp amp dali_rec 0x00 CTRLBYT 0x00 Page erase CPUSPD Ox4F 4 19 6608 LADDR unsigned int TRIM_FACTOR_ADDR Last address in the flash memory DATA ICGTR clock_write if TRIM_FACTOR ICGTR trimmed TRU Gl dali rec PTB amp 0x40 Trap lost interupts interrupt void cpu_Trap void while 1 1 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 123 DALI Slave Source Code Files G 6 Slave dali h dali h This header contains definitions for the dali module Prepared Motorola AB Functional level Hardware Revision R1A Rev Date Reason description 001110 Initial version 010212 Released version iffndef DALI define DALI Initialize extern void dali_Init void Sends the DALI answer on the dali port extern void dali_SendAnswer void Interrupt handler for incoming data on the dali port extern interrupt void dali_Start void Interrupt handler for timebase module extern interrupt void dali_Tick void endif DRM004 Rev 3 0 Digitally Ad
85. iteFlash RANDOM ADDRESS M ADDR TCNTL Read timer counter to get a random number lamp WriteFlash RANDOM ADDRESS L ADDR TCNTL Read timer counter to get a random number break case COMPARE random address RANDOM ADDRESS H 16 RANDOM ADDRESS M 8 RANDOM ADDRESS L search address search address h 16 search address m 8 search address 1 if random address search address withdraw FALSI Gl if random address search address answer OxFF YES flag SEND_ANSWER break case WITHDRAW withdraw TRU break DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 142 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c case SEARCHADDRH search_address_h command break case SEARCHADDRM search_address_m command break case SEARCHADDRL search_address_l command break case PROGRAM SHORT ADDRESS if selection TRUE if lamp TestFailure TRU Gl if command 255 lamp WriteFlash SHORT ADDRESS ADDR 255 else if dtr amp 0 7 gt gt 1 lt 63 lamp WriteFlash SHORT ADDRESS ADDR command amp 7 gt gt 1 else random_address RANDOM_ADDRESS_H lt lt 16 RANDOM_ADDRESS_M lt lt 8 RANDOM ADDRESS L search address search address lt lt 16
86. ky diode SOD106A Temic 1 MLD1N06CL Power transistor DPAK Motorola ON R1 10 1 8 W Resistor 0805 R2 0 18 0 1 W Resistor 2512 Megitt R3 240 Q 1 8 W Resistor 0805 R4 39 kQ 1 8 W Resistor 0805 R5 10 kQ 1 8 W Resistor 0805 R6 10 kQ 1 8 W Resistor 0805 R7 10 kQ 1 8 W Resistor 0805 R8 10 kQ 1 8 W Resistor 0805 R9 3 9 1 8 W Resistor 0805 R10 200 Q 1 8 W Resistor 0805 Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Slave Bill of Materials 83 DALI Slave Bill of Materials Table E 1 DALI Slave Bill of Materials Continued Id Type Description Package Supplier C1 Ceramic 0 1 uF 25 V Capacitor 0805 GRM40 Murata C2 Ceramic 0 33 uF 16 V Capacitor 0805 GRM40 Murata C3 Ceramic 0 1 uF 25 V Capacitor 0805 GRM40 Murata 51 0403001 4 DIP switch SMD APEM X1 MSTBA 2 5 4 G 5 08 Connector 5 08 mm Phoenix X2 MSTBA 2 5 2 G 5 08 Connector 5 08 mm Phoenix JP1 MTA100 156 4 p Connector 2 54 mm straight AMP JP2 MTA100 156 6 p Connector 2 54 mm straight AMP JP3 Not mounted JP4 Not mounted DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 84 DALI Slave Bill of Materials MOTOROLA Designer Reference Manual DALI Unit Appendix F DALI Master Unit Source Code Files F 1 Contents MOTOROLA F2 M uno PTT 86 3 ER o Hoc fice ey eee we cab ated wauu as a a
87. l timing The same timer is used for generating the pulse width modulator PWM signal for controlling the light level The current measurement is done by using the analog to digital converter ADC If the memory is empty the user defined data will be set to the default values as shown in Table 5 1 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit 57 DALI Slave Unit Table 5 1 Default Values for the User Defined Data Memory Position Type of Parameter Default Value FD80 Power on level FE FD81 System failure level FE FD82 Minimum level 01 FD83 Maximum level FE FD84 Fade rate 07 FD85 Fade time 00 FD86 Short address FF FD87 FD89 Random address FF FF FF FD8A FD8B Group 00 00 FD8C FD9B Scene FF FF The storage of new user defined data in the FLASH memory is handled by the on chip FLASH programming routines To erase the data area in the FLASH memory a call is made to 1ash erase which is defined as define flash erase asm ldhx SFD80 njsr 1006 n The definition for flash write is define flash write asm ldhx SFD80 njsr 1009 n DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 58 DALI Slave Unit MOTOROLA DALI Slave Unit The Software INITIALIZE VARIABLES COPY FLASH DATA AREA TO BUFFER MERGE NEW DATA WI
88. lds th static unsigned int demo tick ae static unsigned char repeat_active Digitally Addressable Lighting Interface DALI Unit True if a command shall be repeated DRM004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 93 DALI Master Unit Source Code Files Initialize void dali_Init void send_active rec_active repeat_active TBCR ISCR 0x2 0x04 Be FALSI FALSE FA 77 m 1 iS Interrupt 9600 times second Enable interrupt Sends the DALI address and command on the dali port void dali_SendData void Check if it is the special command for starting the demo mode if demo_tick demo_scene address command flag 0 0 BROADCAST GO_TO_SCEN EMO_MODE B e 1 NEW DATA address BROADCAST amp amp command DEMO Check if some commands shall be repeated if repeat_active TRUE repeat_active FALSE else if address amp 0x01 Command if address amp 0 else DRM004 Rev 3 0 Special command if address INITIALIS I I Command shall be repeat active TR Normal command Sur Command shall be repeat_active TRU UE address amp 0xE0 0xC0 address RANDOMISI repeated within 100 ms
89. le 41 3 0 6 pour ae bd odo do dar dro ie eed 41 3 6 Upgrading the Software 41 3 6 1 Board Configuration 42 3 6 2 Monitor Mode Software 42 3 6 3 Replacing the GOUB 43 Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 DALI Master Unit 27 DALI Master Unit 3 2 Introduction 3 3 Features DRM004 Rev 3 0 This section describes the design hardware and software of the DALI Digital Addressable Lighting Interface master unit The unit has a human interface consisting of e 4 digit liquid crystal display LCD Two shaft encoders e A push button With these the operator could select and address a DALI command to be sent over the DALI interface The master unit also has an RS232 interface for communicating with a PC and a monitor mode interface to enable download of new software The master unit is designed as a multi purpose communication controller with these features e 68 908 8 Adisplay composed of a 4 digit LCD Akeyboard composed of two shaft encoders and a push button ADALI interface ARS232 interface Amonitor mode interface Asmall wire and wrap area for custom extensions Refer to Section 2 DALI Demonstration Board for a description of how to use the DALI master unit Digitally Addressable Lighting Interface DALI U
90. level MIN LEVEL lamp_SetLevel 1 1 1 state_no IDLE_STATE break Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 145 DALI Slave Source Code Files case RECALL MAX LEVEL power failure FALSE lamp SetLevel MAX LEVEL S b tate no IDLE STATE reak case RECALL MIN LEVEL power failure FALSE lamp SetLevel MIN LEVEL State no IDLE STATE break case STEP DOWN AND OFF power failure FALSE if level 0 if level MIN_LEVEL lamp SetLevel 0 else lamp SetLevel level 1 State no IDLE STATE break case ON_AND_STEP_UP power_failure FALSE if level MAX_LEVEL if level 0 lamp_SetLevel MIN_LEVEL else lamp_SetLevel 1 141 State no IDLE STATE break case RESET search_address_h OxFF search address m OxFF search address 1 OxFF lamp ResetFlash lamp_SetLevel 254 State no IDLE_STATE break case STORE_ACTUAL_LEVEL_IN_THE_DTR dtr level break DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 146 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code
91. level lt 253 if last_channel 0 1 log_level new_ 1 11 last_channel 1 else TCHO log_level new_ last_channel 0 TSCO 0 01 level new_level if new_level 254 TSCO 0x01 level new_level returns TRUE if static unsigned char lamp_TestFailure void unsigned char current_level current_level level lamp SetLevel 254 measure time 5 whil measure time 0 COPCTL 0x00 DRM004 Rev 3 0 Turn on Lamp off Lamp off Not 100 duty cycle Set the PWM period Set the PWM period Not 100 duty cycle 100 duty cycle bad lamp lamp for measurement Wait until level is stabilized 100 ms Clear the COP counter Digitally Addressable Lighting Interface DALI Unit 140 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c Measure voltage over shunt resistor by using the built in A D converter ADICLK 0x80 Set the ADC input clock to approximately 1 MHz ADSCR 0x03 Select channel 3 and start conversion while ADSCR amp 0x80 0 Wait until conversion is ready lamp SetLevel current level Restore the previous level if ADR 0 return FALSE Lamp is working return TRUE Start dimming using the fade time static void lamp_StartDimFadeTime unsigned cha
92. marked Monitor using a serial communication cable e Connect cable between JP2 on the DALI slave unit see Appendix D DALI Slave Unit Schematic and Layout and JP6 on the DALI Master unit see Appendix B DALI Master Unit Schematic and Layout e Set the DIP switch on the DALI slave unit to OFF When the power supply is reconnected the processor is in the monitor mode After exiting the monitor mode the cable between the pin headers has to be removed and the DIP switch has to be set to ON to return to the normal mode 5 6 2 Reprogramming the Code DRM004 Rev 3 0 By using monitor mode software the FLASH memory ofthe DALI master unit can be erased and new software downloaded Erasing the memory also clears all user defined data in the slave unit including the short address Therefore the user defined data especially the short address has to be set when downloading of new software and clock trimming are finished Digitally Addressable Lighting Interface DALI Unit 60 DALI Slave Unit MOTOROLA DALI Slave Unit Upgrading the Software The interrupt vector is cleared when other parts of the FLASH memory are erased Since the slave unit updates the contents of the FLASH memory during execution it is necessary to protect the interrupt vector area After the code is replaced the memory position FF7E FLASH Block Protect Register has to be set to FE Trimming of the internal clock has to be done a
93. mmands shall be repeated Wait unti 1 da while ISCR 0x06 TSC amp 0x40 Digitally Addressable Lighting Interface DALI Unit send_active li port is idle rec active Disable 1 interrupt Disable timer overflow interrupt DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 125 DALI Slave Source Code Files Delay befor answering send_value 0x80 send_position 0 send_active TRUE Activate Interrupt handler for incoming da interrupt void dali_Start void the timer module to transfer ta on the dali port RQ1 interrupt Disable timer overflow interrupt No bit has been received Value is low when starting to receive ISCR 0x06 Disable I TSC amp 0x40 address 0x00 Clear address command 0x00 Clear command rec_bit 0 rec_value 0x00 rec position 0 Activate the timer module to receive rec active TRUE Interrupt handler for timebase module interrupt void dali_Tick void unsigned char temp_value TBCR 0x08 if rec active TRUE temp_value PTB amp 0x40 rec if temp value rec value An edge has been dete switch rec_bit case 0 Start bit rec_bittt rec_position 0 break case 17 First stop bit if rec_position gt 6 Stop bit erro rec_active FAL TSC
94. names are the property of their respective owners Motorola Inc is an Equal Opportunity Affirmative Action Employer Motorola Inc 2002 DRM004 D
95. nector 5 08 mm Phoenix X2 D sub 9 p female 90 Connector Hole D sub 9 p female 90 Connector Hole FI 349 30 SE15K W Heat sink Alutronic Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Master Unit Bill of Materials 77 DALI Master Unit Bill of Materials DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 78 DALI Master Unit Bill of Materials MOTOROLA Designer Reference Manual DALI Unit Appendix D DALI Slave Unit Schematic and Layout This appendix includes e DALI slave schematic Figure D 1 e DALI slave layout Figure D 2 Refer to Appendix B DALI Master Unit Schematic and Layout for the mater unit schematic and layout information Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit Schematic and Layout 79 08 jnoKe pue ALIS VIOYOLOW 0 v00I NHG eoeneiu 6unuBi1 Ajjey61q MC78L00A D2 aoci BYS10 45 2 R8 IC3 10k 1 2 4 AC COLL 40 6 12 2 3 MSTBA4 PVAL3N SFH6206 APEMIKNO4 GND PING
96. new level break default break Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 155 DALI Slave Source Code Files G 12 Slave main c main c This module contains the main function Prepared Motorola AB Functional level Application Revision RIA Rev Date 001023 010212 Reason description Initial version Released version include common h include iokx8 h include cpu h include rs232 h include dali h include lamp h Global variables declaration unsigned char address unsigned char command unsigned char answer unsigned int flag Main function void main void address 0x00 command 0x00 answer 0x00 flag 0x00 cpu rs232 Init dali Init lamp Init ei DRM004 Rev 3 0 The DALI address The DALI command The DALI answer Keep track of all events Initialize when starting Initialize when starting Initialize when starting Initialize when starting Initialize the cpu module Initialize the rs232 module Initialize the dali module t Initialize the lamp module Enable interrupt Digitally Addressable Lighting Interface DALI Unit 156 DALI Slave Source Code Files MOTOROL
97. ning The LCD on the master unit should show 00 00 see Figure 2 2 The system is now ready to accept commands according to the DALI standard ADDRESS H HsH H COMMAND Figure 2 2 The LCD Display The LCD on the master shows data to be sent to the slave as two hexadecimal numbers Normally this is an address followed by a command By turning the shaft encoders the address and the command Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Demonstration Board 25 DALI Demonstration Board 2 7 Examples can be changed Pushing the button on the right side of the shaft encoders sends the data to the slave units The data sent may result in an answer from the slave This is shown on the LCD as Axx where xx stands for a hexadecimal number For more information regarding addressing modes and commands see Section 4 DALI Protocol Standard Address 0xFF and command OxFF have a special meaning in this system Selecting this initializes a demo sequence where the master automatically sends a command to change the scene with 3 second s interval It starts with scene 0 and continues until scene 15 and after that it starts with scene 0 again This will continue until new data is selected If an individual lamp is to be addressed the factory settings for the short addresses of the slave units are 0 1 2 and Here are some examples to test the system Enter the ad
98. nit 28 DALI Master Unit MOTOROLA DALI Master Unit Hardware 3 4 Hardware The DALI master unit is built around the MC68HC908KX8 Connected to the central processor unit CPU are DALI interface Keyboard interface LCD interface e RS232 interface e Monitor mode interface The RS232 and the monitor mode interfaces are electrically isolated from the rest of the unit This is done to enable the DALI slave unit to use the same circuitry Therefore to use these interfaces separate cabling has to be connected See Figure 3 1 DALI INTERFACE LCD RS232 TEA presen KEYBOARD MONITOR SUPPLY INTERFACE Figure 3 1 DALI Master Unit Schematics layout and parts list can be found in Appendix B DALI Master Unit Schematic and Layout and in Appendix C DALI Master Unit Bill of Materials The hardware design is intended for demonstration purposes only It is functionalin a normal office environment There are many possibilities to improve the design for increased functionality and reliability Costs can be reduced for high volume production Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 29 DALI Master Unit 3 4 1 Microcontroller Unit MCU The MCU used in this design is the MC68HC908KX8 that has these advantages Low pin count Internal clock o
99. nnected to the RS232 driver circuit IC6 through the pin header JP5 The external connection is by way of a D sub connector X3 The RS232 interface is not protected against over voltages different ground potential or EMI interference Connect the cable when the system is not powered See Figure 3 6 12 V PTBA RXD IC6 PTB5 TXD OOOOO OOOO OOOO X3 gt KYB Figure 3 6 RS232 Interface DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 34 DALI Master Unit MOTOROLA DALI Master Unit Hardware 3 4 6 Monitor Mode Interface The monitor mode interface is connected to the processor PTA0 PTA1 PTB6 and IRQ1 if all four switches on the DIP switch are off and a cable is connected between the pin header JP1 and pin header JP6 Connect the cable when the system is not powered When power is returned the processor is in monitor mode see MC68HC908KX8 MC68HC908KX2 HCMOS Microcontroller Unit Technical Data Motorola order number MC68HC908KX8 D for more information The communication with the processor during the monitor mode goes through the D sub X2 the RS driver circuit IC6 and the buffer IC7 The crystal oscillator QG1 ensures that the RS232 communication speed is 9600 baud See Figure 3 7
100. o the processor to indicate if the software is running correctly See Figure 5 2 5V MAN 01 Figure 5 2 LED Interface More information regarding the CPU can be found in the MC68HC908KX8 MC68HC908KX2 HCMOS Microcontroller Unit Technical Data Motorola order number MC68HC908KX8 D The DALI interface of the slave unit will not supply any current Therefore it can easily be optically isolated to prevent ground loops Although making the solution polarity insensitive is not stated by the DALI standard it is suggested as an improvement In this application this is done by having two way opto diodes and an electronic relay Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Slave Unit 51 DALI Slave Unit The transmission uses an optically isolated electronic relay 1C5 almost short circuiting the DALI communication cables it lowers the voltage since the current is limited By using free pins on the inverter 2 the processor PTB7 there is enough current for controlling See Figure 5 3 5V DALI 7 gt gt O IC2 IC5 Figure 5 3 DALI Transmit Circuit The reception is done by a two way opto coupler IC3 To get a true logical signal the opto coupler is connected to an Schmitt trigger inverter 2 before the signal reaches the processor IRQ1 and PTB6 See Figure 5 4 Oz WN 01 4 gt
101. odules will do several processor dependent functions TIM ADC etc may be used in one module See Figure 3 9 The source code can be viewed in Appendix F DALI Master Unit Source Code Files Digitally Addressable Lighting Interface DALI Unit 36 DALI Master Unit MOTOROLA NOTE 3 5 1 Main Module DALI Master Unit The Software DALI MAIN KEYS LCD RS232 Figure 3 9 DALI Master Software All code is written in C language except for the startup routine The assembler compiler and linker used are from COSMIC Software which can be found at http www cosmic software com There is also the possibility of using software from Metrowerks which can be found at http www metrowerks com The main module consists of initializing global variables calls to initializing routines in other modules and an eternal loop In the eternal loop different flags are checked to see if an action has to be taken The computer operating properly COP watchdog counter is also cleared in the loop See Figure 3 10 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 37 DALI Master Unit INITIALIZE VARIABLES Y INITIALIZE MODULES Y ENABLE INTERRUPTS LIGHT LED gt Y CLEAR COP YES SHOW NEW DATA ON LCD NO YES SEND DATA ON DALI NO NO m
102. or void endif DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 106 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master Icd c F 12 Master Icd c 1 Fy This module handles all lcd related tasks Prepared Motorola AB Functional level Hardware Revision RIA Rev Date Reason description P1A 001023 Initial version RIA 010212 Released version include common h include iokx8 h Translation tables between hexadecimal digits and corresponding bits to set on the LCD define COLON 0x01000000 const unsigned long digit1 16 0 000 000 0x00082000 0 000 000 0x000E6000 0x000B2000 0x00076000 0x0007E000 0x000C2000 0 000 000 0x000F2000 0x000FA000 0x0003E000 0x0005C000 0x000AE000 0x0007C000 0x00078000 const unsigned long digit2 16 0 00 00 00 0x00800200 0x00D00600 0x00B00200 0x00700600 0x00700E00 0x00C00200 0xOOFO0E00 0x00F00200 0x00F00A00 0x00300E00 0x00600C00 0x00900E00 0x00700C00 0x00700800 const unsigned long digit3 16 0x1C0000E0 0x10000020 0x1A0000CO 0x1A000060 0x16000020 0x0E000060 0 0 0000 0 0x18000020 0 1 0000 0 Ox1E000020 Ox1E0000A0 0x060000E0 0 0 0000 0 0x120000E0 0 0 0000 0 0 0 000
103. p 0x0F Digitally Addressable Lighting Interface DALI Unit 108 DALI Master Unit Source Code Files MOTOROLA DALI Master Unit Source Code Files Master Icd c Print the answer on the LCD module void lcd_ShowAnswer void unsigned long result result digit2 0x0A Ox0F lcd SendData result digit3 answer amp 0 0 gt gt 4 digit4 answer amp Print the error code on the LCD module void lcd ShowError void unsigned long result result digit2 0x0E digit3 error amp 0 0 gt gt 41 digit4 error 6 0 0 lcd SendData result Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 109 DALI Master Unit Source Code Files F 13 Master main c main c This module contains the main function Prepared Motorola AB Functional level Application Revision RIA Rev Date Reason description 001023 Initial version RIA 010212 Released version include common h include iokx8 h include cpu h include 1 include keys h include rs232 h include dali h Global variables declaration c nsigned char address nsigned char command c c nsigned char answer c nsigned char error c nsigned int flag Main function void main void address 0x00 command 0x00 answer
104. pt else Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 127 DALI Slave Source Code Files rec_bit rec_position 0 break case 18 Second stop bit if rec position 8 Receive ready flag NEW DATA rec active FALSE TSC 0x40 Enable timer overflow interrupt ISCR 0x04 Enable 1 interrupt break default The address and command bits if rec_position 10 Data bit error too long delay befor dge stop receiving rec_active FALSE TSC 0x40 Enable timer overflow interrupt ISCR 0x04 Enable 1 interrupt break if send_active TRU if send position amp 0 03 0 amp 0 80 send_value if send_position 24 send_value 0 00 First half of start Dit if send_position 28 send value 0x80 Second half of start bit if send_position gt 32 amp amp send_position lt 92 Extract bit level temp_value answer gt gt 92 send_position 8 amp 0 01 Check if first or second half of data bit if send position amp 0x04 0 First half if temp_value 0x00 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 128 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave dali c send_value 0x80 else
105. quential or incidental damages Typical parameters which may be provided in Motorola data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Motorola does not convey any license under its patent rights nor the rights of others Motorola products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur Should Buyer purchase or use Motorola products for any such unintended or unauthorized application Buyer shall indemnify and hold Motorola and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part MOTOROLA Motorola and the Stylized M Logo are registered in the U S Patent and Trademark Office digital dna is a trademark of Motorola Inc All other product or service
106. r Unit Schematic and Layout DRM004 Rev 3 0 757 O Oooo 941 Sdf 1995 UE o G D o oD b 5055 2 LTY e p e e Qooooooooooooo00000Q T 9 g 48 00000000000000000000 0 1510 0000000 0000000000000 x x 9 w w a 3 q FOX 0000000000 2919 5505000000 R OOOOOOOOOOOOOOOOOOOO OJO O O OJO XOX oo N 00000000 Digitally Addressable Lighting Interface DALI Unit Figure B 2 DALI Master Layout 74 DALI Master Unit Schematic and Layout Designer Reference Manual DALI Unit Appendix C DALI Master Unit Bill of Materials This appendix provides a bill of materials for the DALI Digital Addressable Lighting Interface master unit Refer to Appendix E DALI Slave Bill of Materials for the slave unit bill of materials Table C 1 DALI Master Bill of Materials Sheet 1 of 3 Id Type Description Package Supplier IC1 MC68HC908KX8 Processor DIP16 Motorola IC2 MC78L05ACP Regulator TO92 Motorola ON IC3 LMC7221BIN Comparator DIP8 National IC4 MC74HC04N Inverter DIP14 Motorola ON IC5 HC0438A LCD driver DIP40 Hughes IC6 MC145407P RS232 driver DIP20 Motorola ON IC7 MC74HC125N 3 state buffer DIP14 Motorola ON IC8 MC78L05ACP Regulator T
107. r new_level if new level 255 Not mask if FADE TIME 0 No fade lamp_SetLevel new_level State no IDLE STATE else Fade with fade time fade_start_level level fade stop level new level fade total fade tick FADE TIME 1 state time fade total State no FADE STATE Handle special commands static void lamp HandleSpecialCommands void static unsigned withdraw static unsigned selection unsigned long random_address unsigned long search_address Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 141 DALI Slave Source Code Files Special command if address gt 0xA7 amp amp address lt 0xBD amp amp address time 0 Not a valid command until INITIALISE has been received return switch address case TERMINATE address_time 0 break case DATA_TRANSFER_REGISTER dtr command break case INITIALISE if command 0x00 command amp Ox7E 1 SHORT ADDRESS address_time 45000 Accept addressing commands for the next 15 minutes withdraw FALSE selection FALSE break case RANDOMISE The algorithm used to get a random number can be improved lamp WriteFlash RANDOM ADDRESS ADDR TCNTL Read timer counter to get a random number lamp Wr
108. re value LL as the lower bits of the search address 7 Program the selected slave with short address 9 XX Check if the selected slave has short address XX YES NO BB 00 The selected slave returns its short address XX XX BD 00 Go into physical selection mode DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 70 DALI Instruction Set MOTOROLA Designer Reference Manual DALI Unit Appendix B DALI Master Unit Schematic and Layout This appendix includes e DALI master schematic Figure 1 e DALI master layout Figure B 2 Refer to Appendix D DALI Slave Unit Schematic and Layout for the mater unit schematic and layout information Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Master Unit Schematic and Layout 71 072 v00I NHG jnoKe7 pue ogeuieuos 1 lseNW Iva mya eoenueiu 6unufr VIOYOLOW 45V cel SEGL 16 o allele Hoosea 9u39 uas
109. ress INITIALISE address RANDOMISI Gl These commands shall be repeated if repeat time 0 repeat_address address repeat_command command repeat_time 5 100 ms return Normal command if command gt 0x20 amp amp command lt 0x80 These commands shall be repeated if repeat_time 0 repeat_address address repeat_command command repeat_time 5 100 ms return repeat_time 0 if address amp 0 0 0 0 address amp 0 0 0 0 Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 153 DALI Slave Source Code Files Handle special com mands lamp_HandleSpecialCommands else Handle normal comm lamp_HandleNormalComm Set the lamp to failure le void lamp_FailureLevel void state_no IDLE STAT Be 1 ands ands vel lamp_SetLevel SYST EM FAILUR EV EL Interrupt handler for timer interface module interrupt void lamp_Tick voi unsigned char new_level unsigned char diff_level TSC amp 0x80 if measure_time 0 measure_tim 2 if repeat_time 0 repeat_time if address_time 0 address_time switch state_no case IDLE STATE break case INIT_STATE state_time Gl d
110. rk on any PC running 32 bit Microsoft Windows and having one free serial communication port It is installed through a standard setup program Follow the instructions on the screen Microsoft and Windows are registered trademarks of Microsoft Corporation in the U S and or other countries Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA PC Software 63 PC Software 6 4 User manual To be able to communicate with the DALI master Aserial communication cable has to be connected between the PC and the D sub on the master unit marked Serial The RS232 communication has to be enabled on the DALI master unit by connecting the pin header JP4 and pin header JP5 with a cable see Appendix B DALI Master Unit Schematic and Layout Before starting the program DALI demo all slave units have to be connected to the master Lamp Lamp 2 Lampa Lemp 4 Scene EN MEE ME p p A fq Ca 4 MOTOROLA see Figure 6 1 DALI Demo Application Start DALI demo through the Start menu in Microsoft Windows The DALI demo application checks all short addresses to search for connected slaves DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 64 PC Software MOTOROLA PC Software The Source Code It displays a tab for every connected lamp On each tab the luminosity and the fade time c
111. rts DDRA 0x00 Initialize PTAO to PTA4 as input registers PTAPUE 0 1 Enable internal pullup on PTAO to PTA4 PTB 0xA1 Set initial values for PTB DDRB 0xA7 Initialize PTBO PTB1 PTB2 5 PTB7 as output register Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit Source Code Files 89 DALI Master Unit Source Code Files Mask IRQ1 interrupt ISCR 0x06 Change internal clock speed to simplify baud rate selection ICGMR 0x40 Results in 19 6608 MHz Trim internal clock if TRIM_FACTOR 0xFF ICGTR TRIM_FACTOR else Clock is not trimmed while amp 0x50 0x50 Initialize SCI for transmission ICGTR 0x40 Start with a low value SCBR 0x06 Baud rate 4800 5 1 0x40 Enable SCI SCC2 0x08 Transmitter enabled ser_rec 0x10 dali_rec 0x40 trimmed FALSE while trimmed FALSE Loop forever while 5 51 amp 0x80 0 00 SCDR 0x55 if 0x10 0 00 amp amp ser_rec 0x00 ICGTR ser rec PTB amp 0x10 if 0x40 0 00 amp amp dali_rec 0x00 CTRLBYT 0x00 CPUSPD Ox4F LADDR unsigned int TRIM_FACTOR_ADDR DATA ICGTR clock_write if TRIM_FACTOR ICGTR trimmed TRU dali_rec PTB amp 0x40 DRM004 Rev 3 0 1f a trim value
112. s Slave iokx8 h port A port B data direction port A data direction port B pull up enable port A SCI SCI SCI SCI 5 5 5 control register 1 control register 2 control register 3 status register 1 status register 2 data register baud rate keyboard interrupt enable timebase module control IRQ status control register configuration register 1 configuration register 2 DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 131 DALI Slave Source Code Files tiny volatile char tiny volatile uint tiny volatile char tiny volatile char tiny volatile uint tiny volatile char tiny volatile char tiny volatile char tiny volatile uint tiny volatile char tiny volatile char tiny volatile char tiny volatile uint tiny volatile char tiny volatile char ICG section tiny volatile char tiny volatile char tiny volatile char tiny volatile char tiny volatile char A D section tiny volatile char tiny volatile char tiny volatile char SIM section volatile char near volatile char near volatile char INTERUPT section near volatile char near volatile char near volatile char FLASH section near volatile char near volatile char near volatile char DRM004 Rev 3 0 ICGCR ICGMR ICGTR ICGDVR ICGDSR ADSCR ADR
113. s described in 3 6 Upgrading the Software However the cable should be connected between JP1 on the DALI slave unit see Appendix D DALI Slave Unit Schematic and Layout and JP5 on the DALI master unit see Appendix D DALI Slave Unit Schematic and Layout Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Unit 61 DALI Slave Unit DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 62 DALI Slave Unit MOTOROLA Designer Reference Manual DALI Unit 6 1 Contents 6 2 Introduction 6 3 Installation Section 6 PC Software aaa qasqu 63 63 Tnm 63 EET 7 4 0 64 65 Dex Rau RA ax MR Ra ede 65 There is a possibility of controlling the DALI Digital Addressable Lighting Interface master through an RS232 interface 9600 baud no parity 8 data bits and one stop bit The DALI master handles data received over the RS232 interface the same way as the data is entered by the shaft encoders and the push button This means that everything that can be done manually on the master board can also be controlled remotely Answers received from a slave unit are also echoed on the RS232 interface The liquid crystal display LCD on the master unit displays all the data communicated To demonstrate this possibility there is a small application called DALI demo The DALI demo application will wo
114. s to default settings _ 21 Store the current light level in the DTR 2 Store the value the DTR as the maximum level 2 Store the value the DTR as the minimum level 2C Store the value in the DTR as the system failure level _ 2D Store the value in the DTR as the power on level d 2E Store the value in the DTR as the fade time B 2F Store the value in the DTR as the fade rate 40 Scene Store the value in the DTR as the selected scene 50 Scene Remove the selected scene from the slave unit _ 60 Group Add the slave unit to the selected group _ 70 Group Remove the slave unit from the selected group _ 80 Store the value in the DTR as a short address _ 90 Returns the status of the slave as XX XX 91 Check if the slave is working YES NO 92 Check if there is a lamp failure YES NO 93 Check if the lamp is operating YES NO 94 Check if the slave has received a level out of limit YES NO DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 68 DALI Instruction Set MOTOROLA Table A 1 Standard Commands Continued DALI Instruction Set Hines Description Answer 95 Check if the slave is in reset state YES NO 96 Check if the slave is missing a short address YES NO 97 Returns the version number as XX XX 98 Returns the content of the DTR as XX XX 99 Returns the device type as XX XX 9A Returns the physical minimum level
115. scillator Embedded FLASH memory 8 Kbytes which can be used for both code and data Embedded random access memory RAM 192 bytes n circuit programmable through the monitor mode interface e M68HC08 compatible code As all members of the M68HC08 Family it has compact and fast executing code as well as several development and support tools available from both Motorola and third parties The possibility of writing data into the FLASH memory during program execution is used in this application However the advantage of having an internal oscillator is not fully realized in this application The most common reason for adjusting the clock frequency is to save power Another reason for using an internal oscillator is to save space If saving space is not necessary than devices like the MC68HC908JK3 with external clock generation can be used to achieve the same design This processor has a slightly bigger package 20 pins instead of 16 pins with one extra input output 1 but is a good alternative for this application Since the size of the code is less than 2 Kbytes MC68HC908KX2 could also be an alternative More information regarding the CPU can be found in the MC68HC908KX8 MC68HC908KX2 HCMOS Microcontroller Unit Technical Data Motorola order number MC68HC908KX8 D DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 30 DALI Master Unit MOTOROLA 3 4 2 DALI Interface DALI Master Unit Har
116. search address m 8 search address 1 if random address search address if command 255 lamp WriteFlash SHORT ADDRESS ADDR 255 else if dtr amp 0 7 gt gt 1 lt 63 lamp WriteFlash SHORT ADDRESS ADDR command amp 7 gt gt 1 break Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 143 DALI Slave Source Code Files case VERIFY_SHORT_ADDRESS if SHORT ADDRESS c ommand amp 0 7 gt gt 1 answer OxFF YES flag SEND ANSWER break case QUERY_SHORT_ADDRE if selection TRU 2 if lamp TestFailure TRU answer SHORT ADDRESS flag SEND ANSWER else random_address RANDOM_ADDRESS_H lt lt 16 RANDOM_ADDRESS_M lt lt 8 RANDOM ADDRESS L Search address search address h 16 search address m 8 search address 1 if random address search address answer SHORT_ADDRESS flag SEND_ANSWER break case PHYSICAL SELECTION selection TRUE break default break Handle normal commands static void lamp HandleNormalCommands void Normal commands switch command case OFF power failure FALSI lamp SetLevel 0 State no IDLE STATE break Gl I DRMO004 Rev 3
117. sed for directly connecting the LED to the processor See Figure 5 10 INITIALIZE VARIABLES Y INITIALIZE MODULES Y ENABLE INTERRUPTS LIGHT LED r gt Y CLEAR COP HANDLE NEW DATA IN LAMP SEND ANSWER ON DALI AND RS232 SET LAMP TO FAILURE LEVEL Figure 5 10 main Flowchart DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 56 DALI Slave Unit MOTOROLA DALI Slave Unit The Software 5 5 2 Central Processor Unit CPU Module 5 5 3 DALI Module 5 5 4 Lamp Module The difference between the CPU module of the slave unit and the CPU module of the master unit is that the setup of ports is adapted to the difference in hardware The data received from a slave unit is 16 bits and the data sent is 8 bits This is opposite to a master unit To avoid disturbance from the timer interface module TIM this is disabled during transmission and reception of data The DALI communication is monitored so that a disconnected slave unit sets its lamp to a failure level This is the largest module It handles all activities related to the lamp These include e Regulating the light level of the lamp by a PWM signal Storing parameters for the user defined data Supervision of the lamp current The lamp module also interprets all DALI commands The timer interface module TIM is used to handle al
118. t DRM004 Rev 3 0 MOTOROLA Table of Contents 9 Table of Contents DRM004 Rev 3 0 3 4 4 3 4 5 3 4 6 3 4 7 3 5 3 5 1 3 5 2 3 5 3 3 5 4 3 5 5 3 5 6 3 6 3 6 1 3 6 2 3 6 3 4 1 4 2 4 3 4 4 5 1 5 2 5 3 5 4 5 4 1 5 4 2 5 4 3 5 4 4 5 4 5 5 4 6 e Ead Re EX RENE 33 RS232 Interface 34 Monitor Mode Interface 35 Power a qa aora p SCR E ed oed a RD Re kika 36 The SOIN ME Laurea quedo ode 36 Main Mod le 2 LA qaqa a w RE 37 Central Processor Unit CPU Module 39 DALI MOGUC ea raaraa ge E poa ar CX E boe 41 Keys 200 MP 41 Liquid Crystal Display LCD Module 41 25232 MOdUIG 41 Upgrading the Software 41 Board be eed wd oat 42 Monitor Mode Software 42 Replacing the Code 43 Section 4 DALI Protocol Standard E senate Eden ere a 45 45 Electrical Specification 46 Protocol L cd cd dico o ss s ge eee wasaka 46 Section 5 DALI Slave Unit L 49 Me QOO __ awia 49
119. the rs232 port extern void rs232 SendAnswer void Interrupt handler for received data on the rs232 port extern interrupt void rs232 ReceiveData void endif DRM004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 158 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave rs232 c G 14 Slave rs232 c rs232 c fh This module handles all tasks related to the rs232 port Prepared Motorola AB Functional level Hardware Revision 1 Rev Date Reason description PIA 001027 Initial version RIA 010212 Released version RIB 011016 Adapted to new clock speed The serial communication interface SCI module is used include common h include iokx8 h static unsigned char first Keeps track if incoming data is address or command Initialize void rs232 Init void SCBR 0x05 Baud rate 9600 SCC1 0x40 Enable SCI SCC2 0x2C Enable receive interrupt transmitter enabled receiver enabled first TRU Gl Next incoming byte is an address Sends the answer on the rs232 port void rs232_SendAnswer void while 5 51 amp 0 80 0 00 Wait until transmit buffer is empty SCDR answer Digitally Addressable Lighting Interface DALI Unit DRM004 Rev 3 0 MOTOROLA DALI Slave Source Code Files 159 DALI Slave Source Code Files Interr
120. tine flash write ei Enable all interrupts Reset flash content static void lamp ResetFlash void unsigned char index Set all variables necessary CTRLBYT 0x00 Page erase CPUSPD Ox4F 4 19 6608 LADDR unsigned int STOP OF FLASH BUFFER Last address in the flash memory Copy data to buffer for index 0 index 32 1 DATAtindex START_OF_FLASH_BUFFER index Merge the new data into the data buffer DATA unsigned char POWER ON LEVEL ADDR START OF FLASH BUFFER 254 DATA unsigned char SYSTEM FAILURE LEVEL ADDR START OF FLASH BUFFER 254 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 138 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave lamp c unsigned char MIN LEVEL ADDR START OF FLASH BUFFER PHYSICAL MIN LEVEL unsigned char MAX LEVEL ADDR START OF FLASH BUFFER 254 unsigned char FADE RATE ADDR START OF FLASH BUFFER 7 unsigned char FADE TIME ADDR START OF FLASH BUFFER 0 unsigned char RANDOM ADDRESS H ADDR START OF FLASH BUFFER OxFF unsigned char RANDOM ADDRES
121. ude common h include iokx8 h define TRIM FACTOR ADDR unsigned char OxFDFF define TRIM FACTOR TRIM FACTOR ADDR Internal clock generator trim factor Initialize void cpu Init void unsigned char trimmed unsigned char ser_rec unsigned char dali_rec if TRIM_FACTOR 0xFF Initialize LVI to 5V CONFIG2 0x08 Initialize LVI to 5V and disable COP CONFIG2 0x09 Initialize ports PTA 0x08 Set initial values for PTA DDRA 0x0C Initialize PTA2 and PTA3 as output registers PTB 0xA0 Set initial values for PTB DDRB 0 0 Initialize PTB5 and PTB7 as output register Mask IRQ1 interrupt ISCR 0x06 Change internal clock speed to simplify baud rate selection ICGMR 0x40 Results in 19 6608 MHz DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 122 DALI Slave Source Code Files MOTOROLA DALI Slave Source Code Files Slave cpu c Trim internal clock if a trim value is stored in flash if TRIM_FACTOR 0xFF ICGTR TRIM_FACTOR else Clock is not trimmed while amp 0x50 20x50 Wait until the signals are stable Initialize SCI for transmission ICGTR 0x40 Start with a low value SCBR 0x06 Baud rate 4800 5 0x40 Enable SCI SCC2 0x08 Transmitter enabled ser_rec 0x10 dali_rec 0x40 trimmed FALSE while trimmed FALSE Loop forever w
122. uit by toggling the PTB output pins RS232 module handles the serial communication over RS232 It uses the serial communication interface module SCI The baud rate is preset to 9600 baud 3 6 Upgrading the Software To be able to reprogram the software the processor has to be set into a monitor mode The monitor mode is a state of the processor where simple debugging and downloading of new code is possible During the monitor mode the processor is running a built in program that communicates through a single pin The monitor mode is described in Digitally Addressable Lighting Interface DALI Unit DRMO004 Rev 3 0 MOTOROLA DALI Master Unit 41 DALI Master Unit more detail in the document MC68HC908KX8 MC68HC908KX2 HCMOS Microcontroller Unit Technical Data Motorola order number MC68HC908KX8 D 3 6 1 Board Configuration To configure the board in monitor mode e Disconnect the power supply and connect a free serial communication port of the PC or the computer that communicates with the processor to the D sub on the DALI master unit marked Monitor using a serial communication cable e Connect a cable between JP1 and JP6 see Appendix DALI Master Unit Schematic and Layout Setthe DIP switch to OFF When the power supply is reconnected the processor is in the monitor mode After exiting monitor mode the cable between the pin headers has to be removed and the DIP switch has to be set to O
123. upt handler for received data on the rs232 port interrupt void rs232_ReceiveData void if 5 51 amp 0x20 Received data available in SCDR if first TRUE address SCDR first FALSE Next data is a command else command SCDR first TRUE Next data is an address flag NEW DATA DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 160 DALI Slave Source Code Files MOTOROLA G 15 Slave vector c vector c This module contains the interrupt vector Prepared Motorola AB Functional level Hardware Revision R1A Rev Date Reason description 1 001023 Initial version 010212 Released version include cpu h include rs232 h include dali h include lamp h void const _vectab dali_Tick Timebase module cpu_Trap ADC conversion complete cpu_Trap Keyboard cpu_Trap SCI transmit rs232 ReceiveData SCI receive cpu_Trap SCI receive error cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved cpu_Trap Reserved lamp_Tick TIM overflow cpu_Trap TIM channel 1 cpu Trap TIM channel 0 cpu Trap CMIREQ dali Start 1 cpu Trap SWI _stext Reset Digitally Addressable Lighting Interface DALI Unit DALI Slave Source Code Files Slave vector c DRM004 Rev 3 0
124. x0009 0 0009 0x0009 0x0009 0x000A 0x000A 0 000 0 000 0 000 0x000B 0x000B 0x000C 0 000 0x000C 0x000D 0 000 0 000 0 000 0 000 0 000 0 000 0 000 0 0010 0x0010 0x0011 0 0011 0x0011 0 0012 0x0012 0x0013 0x0013 0 0014 0x0015 0 0015 0x0016 0x0016 0x0017 0x0018 0x0018 0x0019 0x001A 0x001A Ox001B 0x001C 0 001 0 001 0 001 0 001 0x0020 0x0021 0x0022 0x0023 0x0023 0x0024 0x0025 0x0027 0x0028 0x0029 0x002A 0x002B 0x002C 0x002D 0x002F 0x0030 0x0031 0x0033 0x0034 0x0035 0x0037 0x0038 0x003A 0x003C 0x003D 0x003F 0x0041 0 0042 0x0044 0x0046 0x0048 0 004 0 004 0x004E 0x0050 0x0053 0x0055 0x0057 0x005A 0 005 0 005 0 0061 0x0064 0x0067 0 006 0x006D 0x0070 0x0073 0 0076 DRMO004 Rev 3 0 Digitally Addressable Lighting Interface DALI Unit 136 DALI Slave Source Code Files MOTOROLA sta sta n ta m ct ct ct c Digitally Addressable Lighting Interface Unit DALI Slave Source Code Files Slave lamp c 0 0079 0x007D 0x0080 0x0084 0x0087 0x008B 0x008F 0x0093 0x0097 0x009B 0 009 0 00 4 0x00A8 OxOOAD 0x00B2 0 00 7 0 00 0 00 1 0 00 6 1 0x00D7 0 00 0 00 3 0x00E9 0 00 0

Download Pdf Manuals

image

Related Search

Related Contents

    HKTS 60BQ/230 - Harman Kardon  Brief User's Guide: Dynamic Systems Estimation (DSE)  操作早見表 - Brother  Single-sided LED Basketball Game Clock and Shot Clock - AV-iQ    Tripp Lite 2.9kW Single-Phase Metered PDU, 120V Outlets (12 5-15/20R), L5-30P, 15ft Cord, 1U Rack-Mount  

Copyright © All rights reserved.
Failed to retrieve file