Writing Software To Control t6963c Based Displays
Writing Software To Control t6963c Based Displays
1. Introduction
So you have a graphics LCD module with a T6963C controller, connected to a Microcontroller, and want to get software written to run it. The document assumes that you have a basic idea of what the LCD module will do and what you want it to do. Reading the .PDF version of the Toshiba Data Sheet on the T6963C is recommended, if this document is unclear. (dont read the original data sheet, as it is very poor)
2.3 Write Command - To Write a Command - The command should be set on D0 - 7 and C/\D taken high, /WR taken low (/RD should be high) /CE pulsed low for greater than 80ns 2.4 Read Status - To check the Status of the T6963C controller C/\D take high, /RD take low (/WR should be high) /CE take low After 150ns read the data on D0-7 /CE take high Note that there is no such thing as reading an command instruction.
As no timings are given for command execution, delaying each command and data until the last is known to have finished so that the status does not need to be checked, (as used frequently on character LCD modules) is more difficult. The Toshiba data sheet states it is not possible, but I have seen code that uses this method with the T6963C. When the check status byte is read, the bit meanings are as follows:MSB
D7 STA7 D6 STA6 D5 STA5 D4 X D3 STA3 D2 STA2 D1 STA1 D0 STA0
STA0 - 0 = command being executed, 1 = ready for new data and command. STA1 - 0 = internal data read/write occurring, 1 = ready for new data and command. STA2 - 0 = internal automode data read occurring, 1 = ready for next data read. STA3 - 0 = internal automode data write occurring, 1 = ready for next data write. X - not used. STA5 - 1 = controller capable of operation. 1 STA6 - 1 = screen peek/copy error (address not in graphic RAM), 0 = no error. STA7 - 0 = blinking areas of display off, 1 = blinking areas of display on. 2 Notes; 1 - I dont know what use this bit has. It is ignored in all software Ive seen. 2 - I believe this is the meaning of this bit.
4.4 In the case of sending more data bytes than is required, only the last 1 or 2 are used. This is useful if you have stored all the required instructions to set up the display as a lookup table, each instruction having 2 data bytes in the table (even if it does not need 2 data bytes), and use the write with two data bytes routine. Commands that dont need the data will ignore it. Commands only need one byte will use the last byte, and ignore the first.
1st data
status check
2nd data
status check
Command
5.1.2 Set GRAPHICS AREA SET to how many bytes later y ou want the next line to start at. Note that this can be the same as the number of bytes to fill one line of the screen, for most efficient use of the RAM, or it can be larger, to make the calculation of the addresses easier to implement in your routines. (If you make less than the number of bytes to fill one line, you get some weird results!) For example for a 240 bit (30 bytes if font set to 8x8) you could use 30, or you could use 32, which is easier to use in calculations. for 30 (1Eh) for 32 (20h)
status check
1st data
status check
2nd data
status check
Command
5.2 To set-up the text part of the display controller, if you are going to use text:5.2.1 Set TEXT HOME ADDRESS to the address that you want to start the text RAM from. If you want the text area of memory before the graphics area, or are just using the
2nd draft - 18/4/98
text area, set it to the start of memory, otherwise set it to an area out the way of the graphics RAM area. e.g. for start at 0000h at 0800h
status check
1st data
status check
2nd data
status check
Command
5.2.2 Set TEXT AREA SET to how many bytes later you want the next line to start at. Note that this can be the same as the number of columns on the screen, for most efficient use of the RAM, or it can be larger, to make the calculation of the addresses easier to implement in your routines. (If you make less than the number of bytes to fill one line, you get some weird results!) For example for a 240 bit (30 columns if font set to 8x8) you could use 30, or you could use 32, which is easier to use in calculations. for 30 (1Eh) for 32 (20h)
status check
1st data
status check
2nd data
status check
Command
5.3 To set-up the display:5.3.1 Set MODE SET to logical OR, EXOR or AND of the text and graphics as required. To use only the text, but with extra display options, there is also TEXT ATTRIBUTE mode (note in this mode, there is no graphics display - the attribute data is in the graphics area instead.) MODE SET also selects whether text characters 00h-7F come from the controllers built in character generator ROM, or from RAM i.e. user-defined. (characters 80h-FFh always come from the RAM). MSB
D7 1 D6 0 D5 0 D4 0 D3 CG D2 MD2 D1 MD1 D0 MD0
MD0-2 1 000 = OR mode. 001 = XOR mode. 010 = AND mode. 100 = TEXT ATTRIBUTE mode. CG 0 = Internal ROM CG, 1 = RAM CG Notes; 1 - I dont know what setting MD0-2 to 011, 101, 110 or 111 would do! - Ill have to try it sometime.
2nd draft - 18/4/98
For example, for OR mode, and internal CG ROM = 1000 0 000 = 80h
status check
Command
80h
5.3.2 Set DISPLAY MODE to set whether the graphic, text or both displays are on, and to set the cursor on or off, and cursor blink on or off MSB
D7 1 D6 0 D5 0 D4 1 D3 GRPH
1
D2 TEXT
D1 CUR
D0 BLK
GRPH 1 = graphics display on. TEXT 1 = text display on. CUR 1 = cursor displayed. BLK 1 = cursor blink on.
Notes; 1 - If using TEXT ATTRIBUTE mode, this bit must be set as well as TEXT For example, graphics and text display on, with cursor, no blink = 1001 1110 = 9Eh
status check
Command
9Eh
5.4 If youve followed the above steps, now you should have a display full of rubbish. If not, check the contrast level, the wiring and the software. 5.5 Display data write and read commands 5.5.1 The ADDRESS POINTER is used for pointing in memory, before writing / read ing text byte, graphic bytes, attribute bytes or user-character bytes (depends where it is pointing, and whether graphics or attribute mode is on). To set the ADDRESS POINTER to a memory address, ready for reading or writing bytes, e.g. to set it to address 0123h
status check
1st data
status check
2nd data
status check
Command
5.5.2 To then send a byte of data, there are 3 command, depending whether you want the pointer address to decrease, stay the same or increase. Write then decrease address pointer command is C2h Write, no change to address pointer command is C4h Write then increase address pointer command is C0h
For example if the address pointer is set to an address in the text RAM area, to display an A (character 21h - note the character set is not ASCII, but ASCII - 20hex) and move the address pointer to the next address:status check
Data
status check
byte to send
21h C0h
Command
5.5.3 Similarly, to read a byte of data from the disp lay RAM, again there are 3 command, depending whether you want the pointer address to decrease, stay the same or increase. Read then decrease address pointer command is C3h Read, no change to address pointer command is C5h Read then increase address pointer command is C1h For example if the address pointer is set to an address in the text RAM area, to read the code of the character at that address and move the address pointer to the next address:status check
Command
status check
C1h
Read data 5.5.4 To save time, e.g. for writing or reading the full screen, DATA AUTO mode is available, where the command is written only one, to set auto mode data read or auto mode data write. After this, no commands are required for each data byte read or written. When finished, auto mode reset needs to be sent to return the controller to normal operation. Note that during auto mode the status check between writing data bytes is of STA2, and between reading bytes is of STA3. STA0 & 1 are not valid until after the auto mode reset . Data Auto Write Set is B0h Data Auto Read Set is B1h Auto Mode Reset is B2h For example Reading data:status check
Command
status check of STA3
B1h
Command
status check of STA2
B0h XXh
Read data 1 . . . .
status check of STA3
Write data 1 . . . .
status check of STA2
Read data n
status check of STA3
Write data n
status check of STA2
XXh B2h
Command
B2h
Command
5.5.4 To set or reset an individual bit, use the BIT SET/RESET command. Only one bit can be set at a time. MSB
D7 1 D6 1 D5 1 D4 1 D3 S/R D2 B2 D1 B1 D0 B0
S/R 1 = Set the bit, 0 = Reset the bit B2-B0 000 - Bit 0 (Right hand bit of byte) 001 - Bit 1 010 - Bit 2 011 - Bit 3 100 - Bit 4 101 - Bit 5 110 - Bit 6 111 - Bit 7 (Left hand bit of byte) For example, to set bit 3
status check
FBh
5.6.1 Cursor Pattern Select - To select the number of line high the cursor is, from the bottom of the character, use:1 Line Cursor is A0h 2 Line Cursor is A1h 3 Line Cursor is A2h 4 Line Cursor is A3h 5 Line Cursor is A4h 6 Line Cursor is A5h 7 Line Cursor is A6h 8 Line Cursor is A7h For example, for a 4 line cursor,
status check
Command
A4h
5.6.2 To set the position of the cursor onscreen, use CURSOR POINTER SET For example for the cursor at 24h across, 03h down
status check
1st data
status check
Xadrs Yadrs
2nd data
status check
Command
2nd draft - 18/4/98
5.7 Character Generator Commands 5.7.1 To set the address at which the character generator RAM starts from, the OFFSET REGISTER SET command is used. If 8K (2000h) of RAM is fitted to the module, only the first four offset data numbers are usable. Data 00000 00001 00010 00011 : 11110 11111 CG RAM hex address range 0000 - 07FFh 0800 - 0FFFh 1000 - 17FFh 1800 - 1FFFh : : F000 - F7FFh F800 - FFFFh
For example to set the CG RAM area to 1800 - 1FFFh, so that character 80h takes up locations 1C00h to 1C07h.
status check
1st data
status check
2nd data
status check
Command
5.7.2 Then to set character number 80h to a user defined character, say below = 0000 0000b = 00h = 0000 0100b = 04h = 0000 1110b = 0Eh = 0001 0101b = 15h = 0000 0100b = 04h = 0000 0100b = 04h = 0000 0100b = 04h = 0000 0000b = 00h 6 x 8 Font 8 x 8 Font
Assuming the CG RAM area is set to 1800 - 1FFFh, set the address pointer to location 1C00h (1800h + 80h x 8) as per section 5.5.1, and write the above 8 bytes using write then increase (section 5.5.2) or data auto write (section 5.5.4). Then setting the address pointer to an address in the text area, and writing 80h will display the character.
Copyright 1997,98 Steve Lawther. This document is provided in good faith, but without warranty of any form. Document based upon Toshiba T6963C Data. All trademark respected.