Application Note
Interfacing to a Graphics Module with a Toshiba
T6963C Controller
Introduction:
The Toshiba T6963C LCD controller is one of the most popular controllers for use in small graphics
displays. For this reason it is used in a number of LCD modules from 128x128 to 240x128 pixels.
This class of module is most commonly used to display a mixture of text and graphics in samall
devices and instruments. It is usually interfaced directly with an embedded 8-bit microprocessor.
This application note describes the use of this controller with a number of graphics modules.
The example used here is based on an 8-bit Intel I8051 microcontroller but applies to almost any
micro-controller.
Functional Description:
The T6963C uses a simple 8-bit data bus to transfer all instructions and data to and from the
display. After power is applied a hardware reset is issued. The controller must then be initialized
with a series of commands to set up the various modes and options available to the user. Once
initialized the display is ready to accept the data to be displayed. This data can be in the form of
bit-mapped graphical data or text data in pseudo ASCII format. The internal character generator is
biased at -20h. which means the user must subtract 20h from the ASCII code before sending it to
the display.
In the bit-mapped mode each byte of data represents 8 pixels on the display. See Figure #1. Text
data can be written in pseudo ASCII format and will be displayed as a 5x7 dot character. The
graphical and text data are written to separate, user assigned, areas, or pages, in the display RAM
within the display module. The user can then choose one of three ways to mix the text and
graphics pages on the display or the text or graphics page can be displayed alone.
1ST BYTE
D3 D4 D5 D7 D0 D1
D6
2ND BYTE
D1
D0
D2
17TH BYTE
Figure #1 Memory map of a 128x128 display
Schematic:
The 80C51 microprocessor is connected to the LCD controller chip via parallel I/O ports in this
example. It could also be connected to the processor's data bus and be mapped into the
processor's data memory area. See figure 2.
Page 1
Application Note
SEND A BLOCK OF DATA
TO THE DISPLAY
Software Flowchart:
MSGD:
SEND A
COMMAND
WITH
MAIN PROGRAM LOOP
PARAMETERS
GET BYTE
FROM TABLE
START:
MSGC:
INITIALIZE
T6963C
SET COUNTER
TO 2
DISPLAY
BITMAP
CALL
WRITED
GET BYTE
FROM TABLE
END
INC. TABLE
POINTER
YES
END
BYTE?
RETURN
NO
WRITE A
COMMAND BYTE
WRITE A
DATA BYTE
STATUS CHECK
CALL
WRITED
STATUS:
SET C/D TO 1
RD LOW
WRITEC:
WRITED:
INC. TABLE
POINTER
STATUS
OK?
STATUS
OK?
NO
NO
DECREMENT
COUNTER
YES
YES
SET C/D TO 1
SET C/D TO 0
CNT =
0?
READ BYTE
RDHIGH
NO
YES
DATA TO P1
WR LOW
GET COMM.
FROM TABLE
CALL
WRITEC
STATUS
OK?
NO
WRHIGH
RETURN
YES
RETURN
Page 3
Application Note
Initialization:
Before the LCD controller can accept or display data or text it must be initialized. This is usually
done immediately after the system is powered up. The following chart lists the initialization
commands and the parameters that accompany them along with a brief explanation of the function
of each. Where a parameter is different for a display that differs in resolution from the 240x64
example, the alternate values are also listed.
Initialization bytes:
COMMAND
CODE PARAMETERS*
FUNCTION
START OF THE TEXT STORAGE AREA IN DISPLAY RAM
0780h
TEXT HOME ADDRESS
40h
80h, 07h
240
8
LINE LENGTH IN CHARACTERS
8 BIT CHARACTER CELL (FS=0).
= 30 = 1eh FOR AN
(28h FOR FS=1)
1eh, 00h
(240x128, 240x64)
160
8
LINE LENGTH IN CHARACTERS
8 BIT CHARACTER CELL (FS=0).
= 20 = 14h FOR AN
(1ah FOR FS=1)
TEXT AREA
14h, 00h
(160x128)
41h
128
8
LINE LENGTH IN CHARACTERS
8 BIT CHARACTER CELL (FS=0).
= 16 = 10h FOR AN
(15h FOR FS=1)
10h, 00h
(128x128)
START OF THE GRAPHICS STORAGE AREA IN DISPLAY
RAM 0000h
GRAPHIC HOME ADDRESS
GRAPHIC AREA
42h
43h
00h, 00h
240
8
LINE LENGTH IN PIXELS
= 30 = 1eh
= 20 = 14h
= 16 = 10h
1eh, 00h
(240x128, 240x64)
160
8
LINE LENGTH IN PIXELS
LINE LENGTH IN PIXELS
"EXOR" TEXT MODE
14h, 00h
(160x128)
128
8
10h, 00h
(128x128)
81h
24h
98h
MODE SET
LOCATION OF NEXT DATA WRITE (OR READ)
IN THIS CASE THE BEGINNING OF THE GRAPHICS AREA
ADDRESS POINTER SET
00h, 00h
TEXT OFF, GRAPHICS ON
DISPLAY MODE SET
* ADDRESSES AREFORMATTEDAS [LSB,MSB]
Displayed image:
Page 4
Application Note
Software:
inc
djnz
clr
dptr
r0,msgc2
a
movc
a,@a+dptr
;get command
$mod51
mov
r1,a
; **************************************************
lcall writec
sjmp msgc
;send command
;next command
; *
; *
; *
*
*
*
T6963 Application Note V1.0
; **************************************************
; MSGD sends the data pointed to by
; the DPTR to the graphics module.
; The processor clock speed is 16MHz.
; Cycle time is .750mS.
; Demo software to display a bit-mapped
; graphic on a 240x64 graphics display
; with a T6963C LCD controller.
msgd:
clr
a
movc
cjne
ret
a,@a+dptr
;get byte
a,#0a1h,msgd1 ;done?
msgd1:
mov
r1,a
lcall writed
;send data
org
ljmp
000h
start
inc
dptr
msgd
;program start
sjmp
org 100h
; WRITEC sends the byte in R1 to a
; graphics module as a command.
start:
; Initialize the T6963C
writec:
lcall status
;display ready?
setb
writec1:
p3.2
;c/d = 1
clr
nop
nop
setb
mov
p3.3
;hardware reset
mov
clr
setb
ret
p1,r1
p3.0
p3.0
;get data
;strobe it
p3.3
dptr,#msgi1
;initialization bytes
lcall msgc
; Start of regular program
; Display graphic
; WRITED sends the byte in R1 to the
; graphics module as data.
writed:
lcall status
;display ready?
;c/d = 0
mov
dptr,#msgi2
;set auto mode
clr
p3.0
lcall msgc
sjmp
writec1
mov
dptr,#msg1
;display graphic
lcall msgd
sjmp
$
; STATUS check to see that the graphic
; display is ready. It won't return
; until it is.
;*************************************************
;SUBROUTINES
status:
setb
mov
mov
p3.2
p1,#0ffh
r3,#0bh
;c/d=1
;P1 to input
;status bits mask
; MSGC sends the data pointed to by
; the DPTR to the graphics module
; as a series of commands with
; two parameters each.
stat1:
clr
mov
setb
anl
clr
subb
jnz
ret
p3.1
a,p1
p3.1
a,r3
c
a,r3
stat1
;read it
msgc:
mov
r0,#2
;# of data bytes
;get byte
;status OK?
msgc2:
clr
a
movc
cjne
ret
a,@a+dptr
a,#0a1h,msgc3 ;done?
msgc3: mov
r1,a
lcall writed
;send it
Page 5
Application Note
;************************************************
; TABLES AND DATA
; Initialization bytes for 240x64
msgi1:
db
db
db
db
db
db
db
db
80h,07h,40h
1eh,00,41h
00,00,42h
1eh,00,43h
00,00,81h
00,00,24h
00,00,98h
0a1h
;text home address
;text area
;graphic home address
;graphic area
;mode set
;address pointer set
;display mode set
msgi2:
db
db
00,00,0b0h
0a1h
;auto mode
;240x64 Bitmap graphic data
;Only the first 8 bytes are shown here
;The real graphic consists of 1920 bytes
;of binary data.
msg1:
db
db
00h,00h,00h,00h,00h,00h,00h,00h
0a1h
end
Page 6
|