Positron Compiler Documentation

Circle

Positron8 · Revision 4.0.6.5 · PDF page 262

Circle Set_Clear, Xpos, Ypos, Radius

Draw a circle on a graphic LCD.

Set_Clear may be a constant or variable that determines if the circle will set or clear the pixels. A value of 1 will set the pixels and draw a circle, while a value of 0 will clear any pixels and erase a circle. Xpos may be a constant or variable that holds the X position for the centre of the circle. Can be a value from 0 to the X resolution of the display. Ypos may be a constant or variable that holds the Y position for the centre of the circle. Can be a value from 0 to the Y resolution of the display. Radius may be a constant or variable that holds the Radius of the circle. Can be a value from 0 to 255.

' Draw circle at position 63,32 with radius of 20 pixels on a KS0108 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 bXpos as Byte
  Dim bYpos as Byte
  Dim bRadius as Byte
  Dim bSetClr as Byte

  DelayMs 100          ' Wait for the LCD to stabilise
  Cls                  ' Clear the LCD
  bXpos = 63
  bYpos = 32
  bRadius = 20
  bSetClr = 1
  Circle bSetClr, bXpos, bYpos, bRadius
  Stop

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

See Also : Box, Line, Pixel, Plot, UnPlot.

View original PDF page 262Open page in PDFOriginal PDF page 262