<<Previous

Next>>

5.16. LOOKDOWN

LOOKDOWN Search, ( Constant{, Constant} ), Var

The LOOKDOWN statement searches a list of 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.

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

 

5.17. LOOKUP

LOOKUP Index, ( Constant{, Constant} ), Var

The LOOKUP statement can be used to retrieve values from a table of 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.

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

 

5.18. LOW

LOW Pin

Makes the specified pin output low. The pin is automatically made an output pin. Only the pin number itself, i.e. 0 to 7, is specified (i.e. NOT Pin0.)

Low 0 'Make Pin0 an output and set it low (0 volts)

<<Previous

Next>>