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.13. CURSORSyntax :Overview :Operators :Example 1 :CURSOR Line , PositionMove the cursor position on the LCD to a specified line and position.Line is a constant, variable, or expression that corresponds to the linenumber from 1 to maximum lines.Position is a constant, variable, or expression that moves the positionwithin the line chosen, from 1 to maximum position.DIM Line as BYTEDIM Xpos as BYTELine = 2Xpos = 1CLS‘ Clear the LCDPRINT "HELLO" ‘ Display the word “HELLO” on the LCDCURSOR Line , Xpos ‘ Move the cursor to line 2, position 1PRINT "WORLD" ‘ Display the word “WORLD” on the LCDIn the above example, the LCD is cleared using the CLS command,which also places the cursor at the home position i.e. line 1, position1. Next, the word HELLO is displayed in the top left corner. The cursoris then moved to line 2 position 1, and the word WORLD is displayed.Example 2 : DIM Xpos as BYTEDIM Ypos as BYTEAgain: Ypos = 1 ‘ Start on line 1FOR Xpos = 1 TO 16 ‘ Create a loop of 16CLS‘ Clear the LCDCURSOR Ypos , Xpos ‘ Move the cursor to position Ypos,XposPRINT "*"‘ Display the characterDELAYMS 100NEXTYpos = 2 ‘ Move to line 2FOR Xpos = 16 TO 1 STEP -1 ‘ Create another loop, this time reverseCLS‘ Clear the LCDCUSROS Ypos , Xpos ‘ Move the cursor to position Ypos,XposPRINT "*"‘ Display the characterDELAYMS 100NEXTGOTO Again‘ Repeat foreverExample 2 displays an asterisk character moving around the perimeterof a 2-line by 16 character LCD.See also :CLS, see PRINT for an LCD connection circuit40Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!