Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Interfacing To A Graphics Module With A Toshiba T6963C Controller

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Application Note

Crystal Clear and Visibly Superior LCD Modules

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 Hantronix LCD modules from 128x128 to
240x128 pixels. This class of module is most commonly used to display a mixture of text and
graphics in small 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
Hantronix graphics modules. The example used here is based on an 8-bit Intel I8051 micro-
controller 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 2ND BYTE


D0 D1 D2 D3 D4 D5 D6 D7 D0 D1

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 Copyright2000, Hantronix,Inc.Allrightsreserved


Application Note
Crystal Clear and Visibly Superior LCD Modules

80C51
33pF 240x64LCDDISPLAY +5v
16.00mHz P1.0
X1
VD D -15V
P1.1 D0
D1
FS
X2 P1.2 D2
33pF D3
P1.3 D4 VL 20K
D5
D6 VSS
P1.4
D7
+5v FG
P1.5
1N4148 + WR
1uF RD
P1.6
RST CE
CD
10k P1.7 RESET

P3.0

P3.1

P3.2

P3.3
Figure 2 Schematic diagram

Software:
The sample program here is written in 8051 assembly language and is designed to work with the
hardware shown in Figure 2. It is based on a 240x64 display but is applicable to any Hantronix
graphics display with the T6963C controller.

The program first resets the display. This reset must last a minimum of 2µS. It then sends a series of
command bytes and parameters to the LCD controller to initialize it. The T6963C requires that the
parameters, if any, are sent in the data mode and must precede the command byte, which is sent in
the command mode.

The controller is initialized with the graphics page at 0000-077fh. This is 1920 bytes which will
accommodate a full screen of data. No text is displayed in this example but the controller is
initialized for text operation to illustrate the process. The text page starts immediately following the
graphics page at location 0780h. All Hantronix graphics displays that have a built in T6963C
controller also have 8k of built-in display RAM.

The FS (Font Select) line is set to a zero in this example which will place the 5x7 pixel character in a
8x8 pixel field. This will produce 30 characters per line with 8 lines per display (240
8 =30 ). The total
number of characters possible in this mode is 240. A one on the FS line will produce an 6x8 pixel
field for each character.

After initialization the controller is set in the auto write mode and the display is filled with a bit-
mapped graphic.

The code example is not written to be efficient but to be as simple as possible to follow.

Page 2 Copyright2000, Hantronix,Inc.Allrightsreserved


Application Note
Crystal Clear and Visibly Superior LCD Modules
SEND A BLOCK OF DATA
Software Flowchart: TO THE DISPLAY
MSGD: SEND A
COMMAND
MAIN PROGRAM LOOP WITH
PARAMETERS
START: GET BYTE MSGC:
FROM TABLE

INITIALIZE
T6963C SET COUNTER
TO 2

DISPLAY CALL GET BYTE


BITMAP WRITED FROM TABLE

END INC. TABLE YES END


POINTER RETURN BYTE?

NO
WRITE A WRITE A STATUS CHECK CALL
COMMAND BYTE DATA BYTE
WRITED
STATUS:
WRITEC: WRITED:

INC. TABLE
POINTER
SET C/D TO 1
STATUS STATUS
OK? NO OK? NO
YES YES DECREMENT
RD LOW COUNTER

SET C/D TO 1 SET C/D TO 0


CNT =
READ BYTE 0? NO
DATA TO P1 YES

RDHIGH GET COMM.


FROM TABLE
WR LOW

STATUS CALL
OK? NO WRITEC
WRHIGH
YES

RETURN
RETURN

Page 3 Copyright2000, Hantronix,Inc.Allrightsreserved


Application Note
Crystal Clear and Visibly Superior LCD Modules

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
TEXT HOME ADDRESS 40h 80h, 07h 0780h
1eh, 00h LINE LENGTH IN CHARACTERS 240 = 30 = 1eh FOR AN
8
(240x128, 240x64) 8 BIT CHARACTER CELL (FS=0). (28h FOR FS=1)
TEXT AREA 41h 14h, 00h LINE LENGTH IN CHARACTERS 160 = 20 = 14h FOR AN
8
(160x128) 8 BIT CHARACTER CELL (FS=0). (1ah FOR FS=1)
10h, 00h LINE LENGTH IN CHARACTERS 1288
= 16 = 10h FOR AN
(128x128) 8 BIT CHARACTER CELL (FS=0). (15h FOR FS=1)

GRAPHIC HOME ADDRESS 42h 00h, 00h START OF THE GRAPHICS STORAGE AREA IN DISPLAY
RAM 0000h
1eh, 00h LINE LENGTH IN PIXELS 240 = 30 = 1eh
8
(240x128, 240x64)
GRAPHIC AREA 43h 14h, 00h LINE LENGTH IN PIXELS 160 = 20 = 14h
(160x128) 8

10h, 00h LINE LENGTH IN PIXELS 128 = 16 = 10h


(128x128) 8

"EXOR" TEXT MODE


MODE SET 81h

ADDRESS POINTER SET LOCATION OF NEXT DATA WRITE (OR READ)


24h 00h, 00h
IN THIS CASE THE BEGINNING OF THE GRAPHICS AREA
TEXT OFF, GRAPHICS ON
DISPLAY MODE SET 98h

* ADDRESSES AREFORMATTEDAS [LSB,MSB]

Displayed image:

Page 4 Copyright2000, Hantronix,Inc.Allrightsreserved


Application Note
Crystal Clear and Visibly Superior LCD Modules

Software: inc dptr


djnz r0,msgc2
clr a
movc a,@a+dptr ;get command
$mod51 mov r1,a
; ************************************************** lcall writec ;send command
; * * sjmp msgc ;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. msgd:
; Demo software to display a bit-mapped clr a
; graphic on a 240x64 graphics display movc a,@a+dptr ;get byte
; with a T6963C LCD controller. cjne a,#0a1h,msgd1 ;done?
ret
msgd1:
mov r1,a
org 000h lcall writed ;send data
ljmp start ;program start inc dptr
sjmp msgd
org 100h
; WRITEC sends the byte in R1 to a
; graphics module as a command.
start:

writec:
; Initialize the T6963C lcall status ;display ready?
setb p3.2 ;c/d = 1
clr p3.3 ;hardware reset writec1:
nop mov p1,r1 ;get data
nop clr p3.0 ;strobe it
setb p3.3 setb p3.0
mov dptr,#msgi1 ;initialization bytes ret
lcall msgc
; WRITED sends the byte in R1 to the
; Start of regular program ; graphics module as data.

; Display graphic writed:


mov dptr,#msgi2 ;set auto mode lcall status ;display ready?
lcall msgc clr p3.0 ;c/d = 0
mov dptr,#msg1 ;display graphic sjmp writec1
lcall msgd
sjmp $ ; STATUS check to see that the graphic
; display is ready. It won't return
;************************************************* ; until it is.
;SUBROUTINES
status:
; MSGC sends the data pointed to by setb p3.2 ;c/d=1
; the DPTR to the graphics module mov p1,#0ffh ;P1 to input
; as a series of commands with mov r3,#0bh ;status bits mask
; two parameters each. stat1:
clr p3.1 ;read it
mov a,p1
msgc: setb p3.1
mov r0,#2 ;# of data bytes anl a,r3 ;status OK?
msgc2: clr c
clr a subb a,r3
movc a,@a+dptr ;get byte jnz stat1
cjne a,#0a1h,msgc3 ;done? ret
ret
msgc3: mov r1,a
lcall writed ;send it

Page 5 Copyright2000, Hantronix,Inc.Allrightsreserved


Application Note
Crystal Clear and Visibly Superior LCD Modules

;************************************************
; TABLES AND DATA

; Initialization bytes for 240x64


msgi1:
db 80h,07h,40h ;text home address
db 1eh,00,41h ;text area
db 00,00,42h ;graphic home address
db 1eh,00,43h ;graphic area
db 00,00,81h ;mode set
db 00,00,24h ;address pointer set
db 00,00,98h ;display mode set
db 0a1h

msgi2:
db 00,00,0b0h ;auto mode
db 0a1h

;240x64 Bitmap graphic data


;Only the first 8 bytes are shown here
;The real graphic consists of 1920 bytes
;of binary data.

msg1:
db 00h,00h,00h,00h,00h,00h,00h,00h
db 0a1h

end

Page 6 Copyright2000, Hantronix,Inc.Allrightsreserved

You might also like