<>

{LET}

{LET} Var = Value

Assign a Value to a Variable. The Value may be a constant, another variable or the result of an expression. Refer to the previous section on operators for more information. The keyword LET itself is optional.

```	LET B0 = B1 * B2 + B3
B0 = Sqr W1```

LOOKDOWN

LOOKDOWN Search,[Constant{,Constant...}],Var

The LOOKDOWN statement searches a list of 8-bit Constant values for the presence of the Search value. If found, the index of the matching constant is stored in Var. Thus, if the value is found first in the list, Var is set to zero. If second in the list, Var is set to one. And so on. If not found, no action is taken and Var remains unchanged.

The constant list can be a mixture of numeric and string constants. Each character in a string is treated as a separate constant with the character's ASCII value. Array variables with a variable index may not be used in LOOKDOWN although array variables with a constant index are allowed. Up to 255 (256 for 18Cxxx) constants are allowed in the list.

```	Serin 1,N2400,B0			' Get hexadecimal character from Pin1 serially
LOOKDOWN B0,[“0123456789ABCDEF”],B1	' Convert hexadecimal character in B0 to decimal value B1
Serout 0,N2400,[#B1]			' Send decimal value to Pin0 serially```

LOOKDOWN2

LOOKDOWN2 Search,{Test}[Value{,Value...}],Var

The LOOKDOWN2 statement searches a list of Values for the presence of the Search value. If found, the index of the matching constant is stored in Var. Thus, if the value is found first in the list, Var is set to zero. If second in the list, Var is set to one. And so on. If not found, no action is taken and Var remains unchanged.

The optional parameter Test can be used to perform a test for other than equal to (A=@) while searching the list.  For example, the list could be searched for the first instance where the Search parameter is greater than the Value by using ">" as the Test parameter.  If Test is left out, A=@ is assumed.

The Value list can be a mixture of 16-bit numeric and string constants and variables. Each character in a string is treated as a separate constant equal to the character's ASCII value. Expressions may not be used in the Value list, although they may be used as the Search value.

Array variables with a variable index may not be used in LOOKDOWN2 although array variables with a constant index are allowed. Up to 85 (256 for 18Cxxx) values are allowed in the list.

LOOKDOWN2 generates code that is about 3 times larger than LOOKDOWN. If the search list is made up only of 8-bit constants and strings, use LOOKDOWN.

LOOKDOWN2 W0,[512,W1,1024],B0

LOOKDOWN2 W0,>[1000,100,10],B0

LOOKUP

LOOKUP Index,[Constant{,Constant...}],Var

The LOOKUP statement can be used to retrieve values from a table of 8-bit constants. If Index is zero, Var is set to the value of the first Constant. If Index is one, Var is set to the value of the second Constant. And so on. If Index is greater than or equal to the number of entries in the constant list, no action is taken and Var remains unchanged.

The constant list can be a mixture of numeric and string constants. Each character in a string is treated as a separate constant equal to the character's ASCII value. Array variables with a variable index may not be used in LOOKUP although array variables with a constant index are allowed. Up to 255 (256 for 18Cxxx) constants are allowed in the list.

```	For B0 = 0 to 5			' Count from 0 to 5
LOOKUP B0,[“Hello!”],B1	' Get character number B0 from string to variable B1
Serout 0,N2400,[B1]	' Send character in B1 to Pin0 serially
Next B0				' Do next character```

LOOKUP2

LOOKUP2 Index,[Value{,Value...}],Var

The LOOKUP2 statement can be used to retrieve entries from a table of Values. If Index is zero, Var is set to the first Value. If Index is one, Var is set to the second Value. And so on. If Index is greater than or equal to the number of entries in the list, no action is taken and Var remains unchanged.

The Value list can be a mixture of 16-bit numeric and string constants and variables. Each character in a string is treated as a separate constant equal to the character's ASCII value. Expressions may not be used in the Value list, although they may be used as the Index value.  Array variables with a variable index may not be used in LOOKUP2 although array variables with a constant index are allowed. Up to 85 (256 for 18Cxxx) values are allowed in the list.

LOOKUP2 generates code that is about 3 times larger than LOOKUP. If the Value list is made up of only 8-bit constants and strings, use LOOKUP.

LOOKUP2 B0,[256,512,1024],W1

LOW

LOW Pin

Make the specified Pin low. Pin is automatically made an output. Pin may be a constant, 0 - 15, or a variable that contains a number 0 - 15 (e.g. B0) or a pin name (e.g. PORTA.0).

```	LOW 0		' Make Pin0 an output and set it low (0 volts)
LOW PORTA.0	' Make PORTA, pin 0 an output and set it low (0 volts)

led	var	PORTB.0	' Define LED pin
LOW led		' Make LED pin an output and set it low (0 volts)	```

Alternatively, if the pin is already an output, a much quicker and shorter way (from a generated code standpoint) to set it low would be:

`	PORTB.0 = 0	' Set PORTB, pin 0 low`
 <>