Datasheet

branch
int
end
trigger
jne
jl
jge
je
ld
add
sub
Directives
.segment
ds
dw
THE STRUCTURE OF A LP5523 PROGRAM
Figure 6 shows an example of a LP5523 program. When this program is run, the program will flash a red LED once per second.
Although this program is short and simple it shows all the main parts of a typical LP5523 program.
Commenting
Commenting starts with a semicolon (;). The compiler will ignore all characters after a semicolon. If you are using PSPad editor
and have customized the editor according to the instructions on first pages of this document, the editor recognizes comments,
directives, labels and instructions automatically and uses different highlighter colors for different datatypes.
Directives
The directives are not translated directly into the LP5523. Instead, directives are instructions for the LASM.exe compiler. Directives
are used to adjust the location of the engine 1, 2 and 3 programs in memory and reserve memory resources in the LP5523 SRAM.
For example .segment program1 is a directive which tells to the compiler that whatever follows is the program for the program
execution engine 1. An overview of the directives is given in the following table.
Directive Description Example source code
.segment Adjust the location of the programs in SRAM. Note the leading dot .segment program1
.segment flashing_light
ds Define Storage; The directive reserves memory resources in the SRAM. The ds directive
takes one parameter, which is the number of words to reserve. The number of bits in a word
(word length) is 16. The allocated words are initialized with zeros
ds 3
ds 17
dw Define constant Word. Inserts a binary word to the SRAM. dw 0000000011111111b
dw FFABh
dw 3
Labels
A label is a symbolic address. Labels are used to mark program line(s), like in branch instruction and labeling mapping table rows.
Labels must have the colon (:) suffix. In the Figure 6 code loop1: is a label which indicates the starting address of the loop.
Instructions
Instructions are executable statements. LASM-compiler translates text-based language source instructions into hex- and binary-
based executable codes. In the example code presented in Figure 6 for example set_pwm is an instruction. Almost all the
instructions take operands, which may be constants (like FFh), or variables stored in the LP5523 registers (like ra) - ra stands for
variable a (register a), rb, for variable b, etc.
30187015
FIGURE 6. Example Code of LP5523 Program
AN-2227 - LP5523 Evaluation Kit
Copyright © 1999-2012, Texas Instruments Incorporated 9