Positron Compiler Documentation

Cls

Source: Positron8 Compiler User Manual, PDF page 263

Syntax

Cls

Or if using a Toshiba T6963 graphic LCD

Cls Text

Cls Graphic

Overview

Clears the alphanumeric or graphic LCD and places the cursor at the home position i.e. line 1, position 1 (line 0, position 0 for graphic LCDs).

Toshiba graphic LCDs based upon the T6963 chipset have separate RAM for text and graphics. Issuing the word Text after the Cls command will only clear the TEXT RAM, while issuing the word Graphic after the Cls command will only clear the Graphic RAM. Issuing the Cls command on its own will clear both areas of RAM.

Example 1

' Clear an alphanumeric or KS0108 graphic LCD
  Cls
                      ' Clear the LCD
  Print "HELLO"
                      ' Display the word "HELLO" on the LCD
  Cursor 2, 1
                      ' Move the cursor to line 2, position 1
  Print "WORLD"
                      ' Display the word "WORLD" on the LCD
  Stop

In the above example, the LCD is cleared using the Cls command, which also places the cursor at the home position i.e. line 1, position 1. Next, the word HELLO is displayed in the top left corner. The cursor is then moved to line 2 position 1, and the word WORLD is displayed.

Example 2

' Clear a Toshiba T6963 graphic LCD.
  Cls
                      ' Clear all RAM within the LCD
  Print "Hello"
                      ' Display the word “Hello” on the LCD
  Line 1,0,0,63,63
                      ' Draw a line on the LCD
  DelayMs 1000
                      ' Wait for 1 second
  Cls Text
                      ' Clear only the text RAM, leaving the line displayed
  DelayMs 1000
                      ' Wait for 1 second
  Cls Graphic
                      ' Now clear the line from the display
  Stop

Notes

The Cls command will also initialise any of the above LCDs. (set the ports to inputs/outputs etc), however, this is most important to Toshiba graphic LCDs, and the Cls command should always be placed at the head of the BASIC program, prior to issuing any command that interfaces with the LCD. i.e. Print, Plot etc.

See also : Cursor, Print, Toshiba_Command.