Positron Compiler Documentation

Box

Source: Positron8 Compiler User Manual, PDF page 261

Syntax

Box Set_Clear, Xpos Start, Ypos Start, Size

Overview

Draw a square on a graphic LCD.

Parameters

Set_Clear may be a constant or variable that determines if the square will set or clear the pixels. A value of 1 will set the pixels and draw a square, while a value of 0 will clear any pixels and erase a square . Xpos Start may be a constant or variable that holds the X position for the centre of the square. Can be a value from 0 to 127. Ypos Start may be a constant or variable that holds the Y position for the centre of the square. Can be a value from 0 to 63. Size may be a constant or variable that holds the Size of the square (in pixels). Can be a value from 0 to 255.

Example

' Draw a square at position 63,32 with a size of 20 pixels
' on a KS0108 graphic LCD
'
  Device = 16F877
  Declare Xtal = 4
  Declare Lcd_DTport = PORTD
  Declare LCD_RSpin = PORTC.1
  Declare LCD_ENpin = PORTE.0
  Declare LCD_RWpin = PORTC.0
  Declare LCD_CS1pin = PORTE.1
  Declare LCD_CS2pin = PORTE.2
  Declare LCD_Type = Graphic
  Dim Xpos as Byte
  Dim Ypos as Byte
  Dim Size as Byte
  Dim SetClr as Byte
  DelayMs 100
                        ' Wait for the LCD to stabilise
  Cls
                        ' Clear the LCD
  Xpos = 63
  Ypos = 32
  Size = 20
  SetClr = 1
  Box SetClr, Xpos, Ypos, Radius
  Stop

Notes

Because of the aspect ratio of the pixels on the graphic LCD (approx 1.5 times higher than wide) the square will appear elongated.

See Also

Circle, Line, LineTo, Plot, UnPlot.