Datasheet

EXAMPLE 4: TRIGGERS AND INTERRUPT
This program shows how to use triggers: the interrupt. Engine 1 sends a trigger to Engine 2 when it has set an LED to 100% PWM
– Engine 2 fades the LED out to 0% PWM. Engine 1 sends an interrupt when it has finished loop1 and waits trigger from Engine
2 AND an external trigger. Pushing the button on the evaluation board causes an external trigger and the sequence starts over.
Use RD button on the Status/Interrupt section (see Figure 5) to clear the interrupt.
row1: dw 0000000000000001b ;Map green LED = D1 on the eval. board.
dw 0000000000000010b ;Map blue LED = D2 on the eval. board.
dw 0000000001000000b ;Map red LED = D7 on the eval. board.
dw 0000000000000100b ;Map green LED = D3 on the eval. board.
dw 0000000000001000b ;Map blue LED = D4 on the eval. board.
dw 0000000010000000b ;Map red LED = D8 on the eval. board.
dw 0000000000010000b ;Map green LED = D5 on the eval. board.
dw 0000000000100000b ;Map blue LED = D6 on the eval. board.
row9: dw 0000000100000000b ;Map red LED = D9 on the eval. board.
.segment program1 ;Program for engine 1.
mux_map_start row1 ;Map the first LED.
mux_ld_end row9 ;End address of the mapping data table.
loop1: ramp 1.0, 255 ;Increase PWM 0->100% in 1 second.
trigger s{2} ;Send trigger to engine2
mux_map_next ;Set the next row active in the mapping table.
branch 8,loop1 ;Loop 8 times.
int ;Send an interrupt.
trigger w{2|e} ;Wait trigger from engine 2 and external trigger.
rst ;Reset program counter and start the program again.
.segment program2 ;Program for engine 2.
mux_map_start row1 ;Map the first LED.
mux_ld_end row9 ;End address of the mapping data table.
loop2: trigger w{1} ;Wait for trigger from engine1.
ramp 1.0,-255 ;Decrease PWM 100->0% in 1 second.
mux_map_next ;Set the next row active in the mapping table.
branch 8,loop2 ;Loop 8 times.
trigger s{1} ;Send trigger to engine1.
rst
.segment program3
;Program for engine 3(empty).
rst
AN-2227 - LP5523 Evaluation Kit
Copyright © 1999-2012, Texas Instruments Incorporated 21