Positron Compiler Documentation

Line

Source: Positron8 Compiler User Manual, PDF page 269

Syntax

Line Set_Clear, Xpos Start, Ypos Start, Xpos End, Ypos End

Overview

Draw a straight line in any direction on a graphic LCD.

Parameters

Set_Clear may be a constant or variable that determines if the line will set or clear the pixels. A value of 1 will set the pixels and draw a line, while a value of 0 will clear any pixels and erase a line. Xpos Start may be a constant or variable that holds the X position for the start of the line. Can be a value from 0 to 127. Ypos Start may be a constant or variable that holds the Y position for the start of the line. Can be a value from 0 to 63. Xpos End may be a constant or variable that holds the X position for the end of the line. Can be a value from 0 to 127. Ypos End may be a constant or variable that holds the Y position for the end of the line. Can be a value from 0 to 63.

Example

' Draw a line from 0,0 to 120,34
  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_Start as Byte
  Dim Xpos_End as Byte
  Dim Ypos_Start as Byte
  Dim Ypos_End as Byte
  Dim SetClr as Byte
  DelayMs 100
                        ' Wait for the LCD to stabilise
  Cls
                        ' Clear the LCD
  Xpos_Start = 0
  Ypos_Start = 0
  Xpos_End = 120
  Ypos_End = 34
  SetClr = 1
  Line SetClr, Xpos_Start, Ypos_Start, Xpos_End, Ypos_End
  Stop

See Also

Box, Circle.