Positron Compiler Documentation

Toshiba_Command

Positron16 · Revision 1.1.3.5 · PDF pages 296–298

Toshiba_Command Command, Value

Send a command with or without parameters to a Toshiba T6963 graphic LCD.

Command can be a constant, variable, or expression, that contains the command to send to the LCD. This will always be an 8-bit value. Value can be a constant, variable, or expression, that contains an 8-bit or 16-bit parameter associated with the command. An 8-bit value will be sent as a single parameter, while a 16-bit value will be sent as two parameters. Parameters are optional as some commands do not require any. Therefore if no parameters are included, only a command is sent to the LCD.

Because the size of the parameter is vital to the correct operation of specific commands, you can force the size of the parameter sent by issuing either the text “Byte” or “Word” prior to the parameter’s value.

Toshiba_Command $C0, Byte $FF01 ' Send the low byte of the 16-bit value.
Toshiba_Command $C0, Word $01     ' Send a 16-bit value regardless.

The explanation of each command is too lengthy for this document, however they can be found in the Toshiba T6963C datasheet.

' Toshiba T6963C Command demo
'
  Device = 24FJ64GA002               ' Select the device to compile for
  Declare Xtal = 16
'
' Toshiba T6963C graphic LCD Pin configuration
'
  Declare LCD_Type = Toshiba         ' LCD's type is Toshiba T6963C
  Declare LCD_DTPort = PORTB.Byte0    ' The LCD's 8-bit Data port
  Declare LCD_WRPin = PORTB.12        ' The LCD's WR pin
  Declare LCD_RDPin = PORTB.11        ' The LCD's RD pin
  Declare LCD_CEPin = PORTB.10        ' The LCD's CE pin
  Declare LCD_CDPin = PORTB.8         ' The LCD's CD pin
  Declare LCD_RSTPin = PORTB.9       ' The LCD's RST pin (optional)
'
' Toshiba T6963C graphic LCD setup configuration
'
  Declare LCD_Font_Width = 8          ' The font width ( 6 or 8)
  Declare LCD_X_Res = 128             ' The X resolution of the LCD
  Declare LCD_Y_Res = 64              ' The Y resolution of the LCD
  Declare LCD_Text_Home_Address = 0   ' The home address of the LCD
  Declare LCD_RAM_Size = 8192        ' The amount of RAM the LCD contains
  Declare LCD_Text_Pages = 1          ' The amount of text pages required

  Include "T6963C.inc"  ' Load the Toshiba T6963C routines into the program
View original PDF page 296Open page in PDFOriginal PDF page 296
    Dim PanLoop As Byte
    Dim Ypos As Byte
'---------------------------------------------------------------------------
Main:
  Cls                                         ' Clear Text and Graphic RAM
'
' Place text on two screen pages
'
  For Ypos = 1 To 6
     Print At Ypos,0,"  THIS IS PAGE ONE     THIS IS PAGE TWO"
  Next
'
' Draw a box around the display
'
  Line 1,0,0,127,0                            ' Top line
  LineTo 1,127,63                             ' Right line
  LineTo 1,0,63                               ' Bottom line
  LineTo 1,0,0                                ' Left line
'
' Pan from one screen to the next then back
'
  Do                                         ' Create an infinite loop
     '
     ' Increment the Text home address
     '
     For PanLoop = 0 To 23
       Toshiba_Command cT6963_SET_TEXT_HOME_ADDRESS , Word PanLoop
       DelayMs 200
     Next
     DelayMs 200
     '
     ' Decrement the Text home address
     '
     For PanLoop = 23 To 0 Step -1
       Toshiba_Command cT6963_SET_TEXT_HOME_ADDRESS , Word PanLoop
       DelayMs 200
     Next
     DelayMs 200
  Loop                                        ' Do it forever

When the Toshiba LCD’s Declares are issued within the BASIC program, several internal variables and constants are automatically created that contain the Port and Bits used by the actual interface and also some constant values holding valuable information concerning the LCD’s RAM boundaries and setup. These variables and constants can be used within the BASIC or Assembler environment. The internal variables and constants are: -

Variables.

_ _LCD_DTPortThe Port where the LCD’s data lines are attached.
_ _LCD_WRPortThe Port where the LCD’s WR pin is attached.
_ _LCD_RDPortThe Port where the LCD’s RD pin is attached.
_ _LCD_CEPortThe Port where the LCD’s CE pin is attached.
_ _LCD_CDPortThe Port where the LCD’s CD pin is attached.
_ _LCD_RSTPortThe Port where the LCD’s RST pin is attached.
View original PDF page 297Open page in PDFOriginal PDF page 297

Constants.

_ _LCD_TypeThe type of LCD targeted. 0 = Alphanumeric, 1 = KS0108, 2 = Toshiba.
_ _LCD_WRPinThe Pin where the LCD’s WR line is attached.
_ _LCD_RDPinThe Pin where the LCD’s RD line is attached.
_ _LCD_CEPinThe Pin where the LCD’s CE line is attached.
_ _LCD_CDPinThe Pin where the LCD’s CD line is attached.
_ _LCD_RSTPinThe Pin where the LCD’s RST line is attached.
_ _LCD_Text_PagesThe amount of TEXT pages chosen.
_ _LCD_Graphic_PagesThe amount of Graphic pages chosen.
_ _LCD_RAM_SizeThe amount of RAM that the LCD contains.
_ _LCD_X_ResThe X resolution of the LCD. i.e. Horizontal pixels.
_ _LCD_Y_ResThe Y resolution of the LCD. i.e. Vertical pixels.
_ _LCD_Font_WidthThe width of the font. i.e. 6 or 8.
_ _LCD_Text_AREAThe amount of characters on a single line of TEXT RAM.
_ _LCD_Graphic_AREAThe amount of characters on a single line of Graphic RAM.
_ _LCD_Text_Home_AddressThe Starting address of the TEXT RAM.

_ _LCD_Graphic_Home_Address The Starting address of the Graphic RAM. _ _LCD_CGRAM_Home_Address The Starting address of the CG RAM.

_ _LCD_End_OF_Graphic_RAMThe Ending address of Graphic RAM.
_ _LCD_CGRAM_OFFsetThe Offset value for use with CG RAM.

Notice that each name has two underscores preceding it. This should ensure that duplicate names are not defined within the BASIC environment.

It may not be apparent straight away why the variables and constants are required, however, the Toshiba LCDs are capable of many tricks such as panning, page flipping, text manipulation etc, and all these require some knowledge of RAM boundaries and specific values relating to the resolution of the LCD used.

See also : LCDRead, LCDWrite, Pixel, Plot, Toshiba_UDG, UnPlot.

View original PDF page 298Open page in PDFOriginal PDF page 298