Positron Compiler Documentation

Pixel

Source: Positron16 Compiler User Manual, PDF page 270

Syntax

Assignment Variable = Pixel Ypos, Xpos

Overview

Read the condition of an individual pixel from a graphic LCD. The returned value will be 1 if the pixel is set, and 0 if the pixel is clear, or if using a colour graphic LCD, it will hold the 16-bit colour of the pixel.

Parameters

Xpos can be a constant, variable, or expression, pointing to the X-axis location of the pixel to examine. This must be a value of 0 to the X resolution of the LCD. Where 0 is the far left row of pixels. Ypos can be a constant, variable, or expression, pointing to the Y-axis location of the pixel to examine. This must be a value of 0 to the Y resolution of the LCD. Where 0 is the top column of pixels. Assignment Variable is a user defined variable that holds the colour of the pixel.

Example

' Read a line of pixels from a KS0108 graphic LCD
  Device = 24HJ128GP502
                                     ' Select the device to compile for
  Declare Xtal = 16
'
' KS0108 graphic LCD declares
'
  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 as Byte
  Dim Ypos as Byte
  Dim MyResult as Byte
  Cls
  Print At 0, 0, "Testing 1-2-3"
' Read the top row and display the result
  For Xpos = 0 to 127
     MyResult = Pixel 0, Xpos
                                     ' Read the top row
     Print At 1, 0, Dec MyResult
     DelayMs 400
  Next

See also : LCDread, LCDwrite, Plot, UnPlot. See Print for circuit.