Toshiba_UDG
Syntax
Toshiba_UDG Character, [Value {, Values } ]
Overview
Create User Defined Graphics for a Toshiba T6963 graphic LCD.
Parameters
Character can be a constant, variable, or expression, that contains the character to define. User defined characters start from 160 to 255. Value\s is a list of constants, variables, or expressions, that contain the information to build the User Defined character. There are also some modifiers that can be used in order to access UDG data from various tables.
Example
' Create four User Defined Characters using four different methods
Device = 18F452
Declare Xtal = 20
Declare LCD_Type = T6963 ' 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 UDG_3[8] as Byte ' Create a byte array to hold UDG data
Dim DemoChar as Byte ' Create a variable for the demo loop
' Create some User Defined Graphic data in EEPROM memory
UDG_1 Edata $18, $18, $3C, $7E, $DB, $99, $18, $18
'
' The main demo loop starts here
DelayMs 100 ' Wait for the LCD to stabilise
Cls ' Clear both text and graphics of the LCD
' Load the array with UDG data
Str UDG_3 = $18, $18, $99, $DB, $7E, $3C, $18, $18
'
' Print user defined graphic chars 160, 161, 162, and 162 on the LCD
'
Print At 1, 0, "Char 160 = ", 160
Print At 2, 0, "Char 161 = ", 161
Print At 3, 0, "Char 162 = ", 162
Print At 4, 0, "Char 163 = ", 163
Toshiba_UDG 160, [Estr UDG_1] ' Place UDG Edata into character 160
Toshiba_UDG 161, [UDG_2] ' Place UDG Cdata into character 161
Toshiba_UDG 162, [Str UDG_3\8] ' Place UDG array into character 162
' Place values into character 163
Toshiba_UDG 163, $0C, $18, $30, $FF, $FF, $30, $18, $0C]
While ' Create an infinite loop
For DemoChar = 160 to 163 ' Cycle through characters 160 to 163
Print At 0, 0, DemoChar ' Display the character
DelayMs 200 ' A small delay
Next ' Close the loop
Wend ' Do it forever
'
' Create some User Defined Graphic data in flash memory
UDG_2: Cdata $30, $18, $0C, $FF, $FF, $0C, $18, $30
Notes
User Defined Graphic values can be stored in on-board EEPROM by the use of Edata tables, and retrieved by the use of the Estr modifier. Eight, and only Eight, values will be read with a single Estr:
UDG_1 Edata $18, $18, $3C, $7E, $DB, $99, $18, $18
Toshiba_UDG 160, [Estr UDG_1]
User Defined Graphic values can also be stored in flash memory, on devices that can access their own flash memory, and retrieved by the use of a label name associated with a Cdata table. Eight, and only Eight, values will be read with a single label name:
Toshiba_UDG 161, [UDG_2]
UDG_2:
Cdata $30, $18, $0C, $FF, $FF, $0C, $18, $30
The use of the Str modifier will retrieve values stored in an array, however, this is not recommended as it will waste precious RAM.
The Toshiba LCD’s font is designed in an 8x8 grid or a 6x8 grid depending on the font size chosen. The diagram below shows a designed character and its associated values.

Text in this figure or table
msb lsb
%00000000 = $18 %00011000 = $18 %00111100 = $3C %01111110 = $7E %11011011 = $DB %10011001 = $99 %00011000 = $18 %00000000 = $18 6 x 8 Font 8 x 8 Font
See also : LCDRead, LCDWrite, Pixel, Plot, Toshiba_Command, UnPlot. See Print for circuit.

