LineTo
Syntax
LineTo Set_Clear, Xpos End, Ypos End
Overview
Draw a straight line in any direction on a graphic LCD, starting from the previous Line command's end position.
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 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. Then from 120,34 to 0,63
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
Xpos_End = 0
Ypos_End = 63
LineTo SetClr, Xpos_End, Ypos_End
Stop
Notes
The LineTo command uses the compiler's internal system variables to obtain the end position of a previous Line command. These X and Y coordinates are then used as the starting X and Y coordinates of the LineTo command.