LCDread
Syntax
Variable = LCDread Ypos, Xpos
Or
Variable = LCDread Text Ypos, Xpos
Overview
Read a byte from a graphic LCD. Can also read Text RAM from a Toshiba T6963 LCD.
Parameters
Variable is a user defined variable. Ypos :- With a KS0108 graphic LCD this may be a constant, variable or expression within the range of 0 to 7 This corresponds to the line number of the LCD, with 0 being the top row.
With a Toshiba T6963 graphic LCD this may be a constant, variable or expression within the range of 0 to the Y resolution of the display. With 0 being the top line. Xpos: - With a KS0108 graphic LCD this may be a constant, variable or expression with a value of 0 to 127. This corresponds to the X position of the LCD, with 0 being the far left column. With a Toshiba graphic LCD this may be a constant, variable or expression with a value of 0 to the X resolution of the display divided by the font width (LCD_X_Res / LCD_Font_Width). This corresponds to the X position of the LCD, with 0 being the far left column.
Example
' Read and display the top row of the KS0108 graphic LCD
Device = 16F1829
Declare LCD_Type = KS0108 ' Target a KS0108 graphic LCD
Dim Var1 as Byte
Dim Xpos as Byte
Cls ' Clear the LCD
Print "Testing 1 2 3"
For Xpos = 0 to 127 ' Create a loop of 128
Var1 = LCDread 0, Xpos ' Read the LCD's top line
Print At 1, 0, "Chr= ", Dec Var1," "
DelayMs 100
Next
Stop
Notes
The graphic LCDs that are compatible with the compiler’s built-in library routines are the KS0108, and the Toshiba T6963. The standard KS0108 display has a pixel resolution of 64 x 128. The 64 being the Y axis, made up of 8 lines each having 8-bits. The 128 being the X axis, made up of 128 positions. The Toshiba LCDs are available with differing resolutions.
As with LCDwrite, the graphic LCD must be targeted using the LCD_Type Declare directive before this command may be used.
The Toshiba T6963 graphic LCDs split their graphic and text information within internal RAM. This means that the LCDread command can also be used to read the textual information as well as the graphical information present on the LCD. Placing the word Text after the LCDread command will direct the reading process to Text RAM.
Example
' Read text from a Toshiba graphic LCD
Device = 18F452
Declare LCD_Type = Toshiba ' Use a Toshiba T6963 graphic LCD
'
' LCD interface pin assignments
'
Declare LCD_DTPort = PORTD ' LCD’s Data port
Declare LCD_WRPin = PORTE.2 ' LCD’s WR line
Declare LCD_RDPin = PORTE.1 ' LCD’s RD line
Declare LCD_CEPin = PORTE.0 ' LCD’s CE line
Declare LCD_CDPin = PORTA.1 ' LCD’s CD line
Declare LCD_RSTPin = PORTA.0 ' LCD’s Reset line (Optional)
'
' LCD characteristics
'
Declare LCD_X_Res = 128 ' LCD’s X Resolution
Declare LCD_Y_Res = 64 ' LCD’s Y Resolution
Declare LCD_Font_Width = 8 ' The width of the LCD’s font
Dim Charpos as Byte ' The X position of the read
Dim Char as Byte ' The byte read from the LCD
DelayMs 100 ' Wait for the LCD to stabilise
ADCON1 = 7 ' PORTA and PORTE to all digital mode
Cls ' Clear the LCD
Print At 0,0," This is for Copying" ' Display text on top line of LCD
For Charpos = 0 to 20 ' Create a loop of 21 cycles
Char = LCDread Text 0,Charpos ' Read the top line of the LCD
Print At 1,Charpos,Char ' Print the byte read on the second line
DelayMs 100 ' A small delay so we can see things happen
Next ' Close the loop
See also : LCDwrite for a description of the screen formats, Pixel, Plot, Toshiba_Command, Toshiba_UDG, UnPlot, see Print for LCD connections.

