Datasheet
4. Programming Examples
This section gives practical programming examples. A series of programs introduce the main features of the LP5523 chip and the
example programs are easy to tailor to the specific needs of end application.
EXAMPLE 1: CONTROLLING MULTIPLE LEDS WITH ONE ENGINE
The example below is basically the program shown in the Figure 6 above (simple LP5523 program);, the LED mapping table below
is used to establish engine1-to-LEDs connection. In the mapping table '0' means that the LED isn't connected to the engine; '1'
means that the LED is connected to the engine. In the example program below bits 6 to 8 are set to ‘1’ so that outputs 7, 8 and 9
are mapped to the engine 1.
LED Mapping Chart
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Output GPO N/A N/A N/A N/A N/A N/A D9 D8 D7 D6 D5 D4 D3 D2 D1
mapping_table: dw 0000000111000000b ;Red LEDs on the evaluation board.
;'1' = LED is mapped; '0'= LED isn't mapped.
.segment program1 ;Begin of a segment.
mux_map_start mapping_table ;Mapping table start address in the memory.
;The first row of the table will be activated
loop1: set_pwm FFh ;Beginning of a loop, set PWM to full scale.
wait 0.48 ;Wait for 0.48 seconds.
set_pwm 00h ;Set PWM to 0%.
wait 0.48 ;Wait for 0.48 seconds.
branch 0,loop1 ;Endless loop.
AN-2227 - LP5523 Evaluation Kit
18 Copyright © 1999-2012, Texas Instruments Incorporated