LineTo
Syntax
LineTo Pixel Colour, 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
Pixel Colour 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. If using a colour graphic LCD, this parameter holds the 16-bit colour of the pixel. 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 the LCD's X resolution. 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 the LCD's Y resolution.
Example
' Draw a line from 0,0 to 120,34. Then from 120,34 to 0,63
Device = 24HJ128GP502 ' Select the device to compile for
Declare Xtal = 16
'
' LCD interface pin assignments
'
Declare LCD_Type = KS0108 ' Setup for a KS0108 graphic LCD
Declare LCD_DTPort = PORTB.Byte0
Declare LCD_CS1Pin = PORTB.8
Declare LCD_CS2Pin = PORTB.9
Declare LCD_ENPin = PORTB.10
Declare LCD_RSPin = PORTB.11
Declare LCD_RWPin = PORTB.12
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 things 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
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.
