11.07.2015 Views

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler5.39. LOOKUPSyntax : Variable = LOOKUP Index , [ Constant { , Constant…etc } ]Overview :Operators :Look up the value specified by the index and store it in variable. If theindex exceeds the highest index value of the items in the list, thenvariable remains unchanged.Variable may be a constant, variable, or expression. This is wherethe retrieved value will be stored.Index may be a constant of variable. This is the item number of thevalue to be retrieved from the list.Constant(s) may be any 8-bit value (0-255). A maximum of 256 valuesmay be included in the list.Example : ‘ Create an animation of a spinning line.DIM Index as BYTEDIM Frame as BYTECLS‘ Clear the LCDRotate: FOR Index = 0 TO 3 ‘ Create a loop of 4Frame = LOOKUP Index , [ “|\-/” ] ‘ Table of animation charactersPRINT AT 1 , 1 , Frame‘ Display the characterDELAYMS 200‘ So we can see the animationNEXT‘ Close the loopGOTO Rotate‘ Repeat foreverNotes :index starts at value 0. For example, in the LOOKUP command below.If the first value (10) is required, then index will be loaded with 0,and 1 for the second value (20) etc.Var = LOOKUP Index , [ 10 , 20 , 30 ]See also :LOOKUPL76Copyright Crownhill 2001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!