![](http://datasheet.mmic.net.cn/380000/EDE702_datasheet_16755629/EDE702_8.png)
Copyright
1998 E-Lab Digital Engineering, Inc. All Rights Reserved.
Page 8
CREATING CUSTOM SCREEN CHARACTERS
You may occasionally have need to display a character not included in the standard ASCII character
set. Or, as is the case in this example, you may need to modify a certain character to make it more
suitable for your application. In this instance, we choose to make a "\" because the backslash
character on most LCD modules is an unusable, odd-looking character. For illustrative purposes, a
BASIC Stamp
(as was depicted in Figure Two) is used as the controlling host.
Because the Hex Codes $00 through $07 are seldom used, we will use these locations to store our
custom characters. Each character is displayed as an 8 row by 5 column grid. Grid data is written to
the CGRAM memory area of the LCD Module (see Table Two for details). Because each character
contains eight bytes of data, and because the CGRAM area starts at $40 (0100 0000 binary, again
see Table Two), the CGRAM address for ASCII character $00 is $40, ASCII character $01 is $48,
ASCII character $02 is $50, etc.
The 5x8 grid is arranged in CGRAM memory as shown below:
- - - X X X X X
($1F, or 0001 1111 binary, would turn on all the pixels in this row)
- - - X X X X X
- - - X X X X X
- - - X X X X X
- - - X X X X X
- - - X X X X X
- - - X X X X X
- - - X X X X X
The "X" locations are turned on or off depending upon whether a 0 or a 1 is written to that
particular location in memory. For instance, to turn all the pixels on in the top row of a character,
we would write the value $1F (0001 1111 binary) to the CGRAM. However, to prevent the
EDE702 from intercepting certain ASCII values as commands and interpreting them as shown in
Table One, we will perform a logical "or" operation on all pixel data that is sent to the CGRAM.
The value that should be "or"ed with the pixel data is $20. Therefore, instead of sending $1F, we
should send $3F (0011 1111 binary). All pixel data in the following code has been logically "or"ed
with $20.
The following BASIC Stamp
I code causes the ASCII character $03 to be displayed as a "\"
character on the LCD module:
REM Wait while LCD powers up
PAUSE 200
REM Set CGRAM address to character $3: $40 + $8 + $8 + $8 = $58
SEROUT 7,T2400,($FE)
SEROUT 7,T2400,($58)
REM Enter data for grid. Example: '---1 0000' on first row attained
REM by sending $10 (0001 0000 binary)
REM NOTE: To prevent the EDE702 from intercepting certain ASCII value
REM and interpreting them as commands, all grid values are "or"ed with $20
REM For example, $10 'or'ed (+) with $20 = $30
SEROUT 7,T2400,($30)
SEROUT 7,T2400,($30)
SEROUT 7,T2400,($28)
SEROUT 7,T2400,($24)
SEROUT 7,T2400,($22)
SEROUT 7,T2400,($21)
SEROUT 7,T2400,($21)
SEROUT 7,T2400,($20)
REM Move cursor back to start of DDRAM area
SEROUT 7,T2400,($FE)
SEROUT 7,T2400,($80)
REM Write newly-defined character
SEROUT 7,T2400,($03)