Programming with LPL
Overview of LPL
Using the LI-6400
22-3
A Simple Example
A simple LPL program is presented in Figure 22-1, which prompts the user
for two numbers, computes their average, displays this value, waits for the
user to press a key, then quits.
Comments in an LPL program are delimited by
/*
and
*/
and can extend over
as many lines as you like. Comments are ignored when the program is actu-
ally run; they serve only to clarify things for people editing or reading the pro-
gram.
The first non-comment we encounter in Listing 22-1 is a
:FLOAT
declara-
tion
:FLOAT
x 0
y 0
This creates two floating point variables for storing the numbers to be aver-
aged. These variables are given the names x and y, with initial values of zero.
Following that is a function declaration (
:FCT
), used to declare a series of ex-
ecutable steps.
/*
Enter 2 values, compute their mean.
*/
:FLOAT
/* define two floating point variables, and
initialize them to 0 */
x 0
y 0
:FCT
Main
{
"Enter 2 values to average"
/* enter two floating point values, store them in X
and Y */
&y &x "%f %f"
ENTER
x y
+
2
/
/* compute the mean */
y x "\nThe average of %f and %f is %f\n"
"\n\nPress Any Key"
GETKEY
DROP
/* Wait for user */
}
22-1. Simple program that prompts for two values, and prints their mean value.
Summary of Contents for LI-6400
Page 1: ...Using the LI 6400 Portable Photosynthesis System ...
Page 15: ...Part I The Basics ...
Page 16: ......
Page 174: ...Making Measurements Answers to Questions 4 56 Using the LI 6400 4 ...
Page 175: ...Part II Useful Details ...
Page 176: ......
Page 200: ...Standard Tools Power ON Hooks 5 24 Using the LI 6400 5 ...
Page 214: ...Real Time Data Real Time Graphics 6 14 Using the LI 6400 6 ...
Page 234: ...Environmental Control Light Control 7 20 Using the LI 6400 7 ...
Page 244: ...Light Sensor Considerations Gallium Arsenide Phosphide GaAsP Sensor 8 10 Using the LI 6400 8 ...
Page 288: ...Data Logging Making Your Own AutoPrograms 9 44 Using the LI 6400 9 ...
Page 289: ...Part III Working With Files ...
Page 290: ......
Page 312: ...The LPL File System Troubleshooting 10 22 Using the LI 6400 10 ...
Page 340: ...Downloading Files Using a Data Capture Program 11 28 Using the LI 6400 11 ...
Page 375: ...Part IV Configuration Issues ...
Page 376: ......
Page 420: ...Defining User Variables Old Style vs New Style 15 18 Using the LI 6400 15 ...
Page 454: ...Using an Energy Balance Further Reading 17 12 Using the LI 6400 17 ...
Page 455: ...Part V Maintenance Troubleshooting ...
Page 456: ......
Page 572: ...Troubleshooting Useful Information 20 46 Using the LI 6400 20 ...
Page 593: ...Part VI Programming ...
Page 594: ......
Page 622: ...Programming with LPL Compiler Directives 22 28 Using the LI 6400 22 ...
Page 846: ...Index I 16 Using the LI 6400 ...