Go to Triangle Digital Support Home Page TDS9092 TECHNICAL MANUAL
Hardware support
Liquid crystal displays
Live website search
Enter key words
 

LIQUID CRYSTAL DISPLAYS

ALPHANUMERIC DISPLAYS

The following words for alphanumeric LCD displays are inside the Forth ROM.

 

#LCD

( - a )

User variable defining one of 8 LCDs

'EMIT

( - a )

User variable vectoring EMIT

'PUT

( - a )

User variable vectoring PUT

<PUT>

( c n - )

PUT uses this for most LCDs

AT

( - a )

User variable. Contains character position.

AWAIT

( - )

Delays until LCD free. Used by PUT etc.

BLINK

( - a )

User variable. 1=character blinks 0=not

CURSOR

( - a )

User variable. 1=cursor on 0=off

DISPLAY-SET

( - )

Sends ONOFF  CURSOR and  BLINK to LCD

ENTRY-SET

( - )

Sends valuse in I/D and SH to LCD

HOME-CURSOR

( - )

Cursor goes to first position

I/D

( - )

User variable. 1=autoinc. character position

LCD

( - a )

Address of control register in LCD

LCDDATA

( - a )

Address of data register in LCD

LCDEMIT

( c - )

Sends c to next position on LCD

LCDKIND

( - a )

User variable. Defines LCD type in use

ONOFF

( - a )

User variable. 1=display visible 0=not

PRIME

( - )

Initialises LCD. Set user variables first

PUT

( c n - )

Puts character c at position n on LCD

R/L

( - a )

User variable. 1=right shifts 0=left

S/C

( - a )

User variable. 1=shift cursor + message 0=shift cursor only

SH

( - a )

User variable. 1=display shifts on write

SHIFT

( - )

Moves message and/or cursor left or right

WIPE

( - )

Blanks LCD

GRAPHICS DISPLAYS

The following words for graphics LCD displays are in the file _G61830.TDS.

 

<BIG

( - )

Revector EMIT to use BIGEMIT . Part of <BIG . emit big characters . BIG>

<TINY

( - )

Revector EMIT to use TINYEMIT . Part of <TINY . emit tiny characters . TINY>

BIG>

( - )

Restore vector. End of structure <BIG . emit big characters . BIG>

BIGEMIT

( c - )

Display 8x14 ASCII character c at current position

BIGTYPE

( a n - )

Display n 8x14 characters, starting at address, a to cursor position

BOX

( x1 y1 x2 y2 - )

Erase a box given bottom left & top right points

G-INIT

( - )

Initialise LCD into graphics mode

GRAPH

( a n - )

Draw graph of n 16-bit words starting at memory address a

ON/OFF

( - a )

Variable containing black/white status:14=turn off pixel 15=turn on pixel

PEL

( x y - )

Turn on (or off) a pixel at position x,y

RECTANGLE

( x1 y1 x2 y2 - )

Draw rectangle given bottom left & top right points

RULE

( xnew ynew - )

Draw straight line from position in XNOW,YNOW to xnew,ynew

TINY>

( - )

Restore vector. End of structure <TINY . emit tiny characters . TINY>

TINYEMIT

( c - )

Display 3x5 ASCII character c at current position

TINYTYPE

( a n - )

Display n 3x5 chars, starting at address, a to cursor position

WINDOW

( x1 y1 x2 y2 - )

Clear window, framed with rectangle, given bottom left & top right points

WIPE

( - )

Clear all screen

XY!

( x y - )

Move write position to x,y

XY@

( - x y )

Current x,y position to stack

XLABELS

( xinc xmin n - )

Label x axis of graph. xinc=increment in number, xmin=min number, n=no of them

XNOW

( - a )

Variable containing x position in pixels

YLABELS

( yinc ymin n - )

Label y axis of graph. yinc=increment in number, ymin=min number, n=no of them

YNOW

( - a )

Variable containing y position in pixels

FILES

Apart from the built-in support for alphanumeric displays, the following files have software for use with Liquid Crystal Displays:

 

_C61830.TDS

Graphics LCDs based on HD61830, but used in character mode

_CURSOR.TDS

Cursor movement etc. on alphanumeric LCDs

_G61830.TDS

Graphics LCDs based on HD61830, used in graphics mode

_KD2064.TDS

Demonstrator turnkey software for the KD2064 board with built-in keyboard and 16 x 4 line LCD

_LM018.TDS

Corrects character positioning on LCD type LM018

_LM041.TDS

Corrects character positioning on LCD type LM041

_MESSAGE.TDS

Packed message strings with index

HARDWARE

Liquid Crystal Displays (LCDs) are often used with the TDS9092 because they have low power consumption like the computer, they interface directly and software to drive them is built in. Any alphanumeric Liquid Crystal Display which has a HD44780 chip in it can be used. This includes displays from Hitachi, Epson, Sanyo, Vikay etc. Available types range in size from 16 characters on one line, to 2 lines of 40.

For larger character displays use a graphics LCD in its character mode, support software is in file _C61830.TDS. For example the Hitachi LMG6401PLGE gives 16 lines of 30 characters.

A graphics display employing the HD61830 chip should be chosen, preferably built into the display. For example the LMG6401PLGE gives 240 x 128 pixels and no interface components to TDS9092 are needed. Graphics displays using other controller chips will need the words PEL WIPE and G-INIT re-writing but then all higher level functions should work. Note that some graphics LCDs need a negative voltage although others will work on +5V only.

Backlit versions such as LMG6401PLGE are available so LCDs can be used in instruments intended for use in dim environments. There are also some fluorescent displays which have an interface compatible with alphanumeric LCDs.

Alphanumeric LCD connections to TDS9092

Alphanumeric LCD connections to TDS9092
Click the diagram for more detail, or to save a copy:
1. in Internet Explorer right click on the picture and select "Save Target as..."
2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.

Graphic LCD connections to TDS9092

Graphic LCD connections to TDS9092
Click the diagram for more detail, or to save a copy:
1. in Internet Explorer right click on the picture and select "Save Target as..."
2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.

 

The diagrams show the connections between the TDS9092 and typical Hitachi alphanumeric and graphics displays. The pin numbering on other manufacturers' displays is often the same but must be checked, it may be different.

The resistor and potentiometer provide a bias which governs contrast. The resistors shown on the data bus lines are needed when using the keyboard facility in addition to the LCD. From experience, displays from Densitron and RS  Components need lower resistor values, try 2K2. If only a small keyboard such as a 4 x 4 keypad is used all 8 resistors are still necessary. When the keyboard is not used the resistors can be omitted in all cases.

ALPHANUMERIC SOFTWARE

Support routines for alphanumeric displays are in the TDS9092. The software initialisation sequence should first set the appropriate value for the user variables BLINK  CURSOR  I/D  LCDKIND   ONOFF  R/L  S/C and SH . Then use PRIME to automatically put the LCD through its initialisation sequence. For example, suppose you have a display with 2 lines of 24 characters, each a 7 x 5 dot matrix. The following may give the characters required:

 

: INITIALISE     ( - part of initialisation on

                 ( power-up

   0 BLINK !     ( cursor should not blink

   1 CURSOR !    ( a cursor is required

   1 I/D !       ( display to be visible on at

                 ( power-up

   $38 LCDKIND ! ( sets 2 line display, 7 x 5

                 ( characters

   1 ONOFF !     ( display to be visible on power-up

   0 R/L !       ( SHIFT would cause a left scroll

   1 S/C !       ( cursor will shift along with

                 ( message

   0 SH !        ( display will not shift as it is

                 ( written to

   PRIME ;       ( set up the display ready for use

 

To calculate the required number for the kind of LCD used start with 30 (hex). Add 8 if the display is 2 lines not one, and add 4 if the display is 10 x 7 matrix not 7 x 5. E.g. $38 will initialise a 2-line 7 x 5 dot display.

Four-line alphanumeric displays like LM041 are electrically 2-line types. Also note that even in 2-line displays the second does not follow on from the first. For example an LM018 has characters 0 to 39 on the top line and 64-79 on the lower. Use files _LM041.TDS or _LM018.TDS as models to correct this positioning and give the programmer a linear character space that starts at the beginning of the top line and finishes at the end of the bottom line.

Here are some tips on using the LCD support words. We suggest storing messages in the dictionary with the ." word. Transfer them to the LCD by revectoring EMIT to use LCDEMIT instead of the word which writes to the serial line. Suppose we want messages like 'Move right by 23.45 meters'. The basic text can be coded and displayed as follows:

 

: <LCD ( - n re-vector EMIT to use LCD

   'EMIT @ R> 2>R ' LCDEMIT CFA 'EMIT ! ;

: LCD> ( n - restore vector

   2R> >R 'EMIT ! ;

: "START" WIPE <LCD ." Ready to start" LCD> ;

: "GOING"
   WIPE   <LCD ." Move       by   meters" LCD> ;

: "GONE"  WIPE <LCD ." Operation completed" LCD> ;

 

Now "START" will show that we are ready to start, "GOING" that the operation is under way etc. Fill in blanks in the second message like this:

 

: "RIGHT" 5 AT ! <LCD ." right" LCD> ;

: "LEFT"  5 AT ! <LCD ." left "  LCD> ;

: "DISTANCE" ( n - show distance n with 2 decimal

             ( places

   S->D      ( convert n to 32-bit double number

   14 AT !   ( use 14th position on the display

   <LCD  2 .#  LCD> ; ( format number on LCD

 

Notice that the direction left/right and distance number can be changed without using the basic "GOING" again. The words "RIGHT" "LEFT" and  "DISTANCE" just write to selected areas of the LCD.

Another example; try this to get an eye-catching circular scrolling message on a small 16 character display:

 

: "MESSAGE"

   ." This message is longer than the display " ;

: ADVERT ( -   demo of circular scrolling message

   0AT <LCD "MESSAGE" LCD>

   BEGIN 40 0 DO SHIFT 400 MS LOOP ?TERMINAL

   UNTIL ; ( stop on Ctrl+C

GRAPHICS DISPLAY SOFTWARE

Support routines for graphics displays based on the HD61830 display controller are in the file _G61830.TDS. Near the start of this file are constants which fix the horizontal and vertical display size and the multiplex ratio. These are available from the LCD's data sheet and you should edit the correct values for your chosen display into the file.

See the word list above and the support file for details but here is a summary of the principal functions. This list is designed to make you familiar with the facilities. Compile _G61830.TDS and then type each example in turn.

 

FUNCTION

EXAMPLE

Initialise display

G-INIT

Open Window

12 12 100 31 WINDOW

Position cursor

15 15 XY!

Write BIG text

<BIG ." Hello! " BIG>

Write TINY text

<TINY ." Hello! " TINY>

Draw in white

WHITE

Blank window

13 13 99 30 BOX

Draw in black

BLACK

Line drawing

15 60 RULE   2 2 RULE

Single Pixel Frame

5 5 50 50 RECTANGLE

Black filled box

15 ON/OFF !   40 40 60 60 BOX

Box drawn in white

14 ON/OFF !   45 45 50 50 BOX

Clear screen

15 ON/OFF !   G-WIPE

Draw graph

0 40 GRAPH

Label axes

1 0 10 XLABELS 2 0 6 YLABELS

MORE THAN ONE LCD

Up to 8 LCDs can be driven from the TDS9092, a different enable signal is needed for each, but all other lines are common.

 

Alphanumeric display

q       Decode address lines A1, A2 and A3 (pin numbers a12, a11 and a10) using a 74HC238 3 to 8 line decoder with positive going outputs.

q       Enable the decoder IC at with signal CS01C0 from the TDS9092.

q       Feed the 8 decoded outputs to the E pins of the different LCDs.

Multiple Alphanumeric LCDs

Multiple Alphanumeric LCDs

Graphic display

q       Decode address lines A1, A2 and A3 (pin numbers a12, a11 and a10) using a 74HC138 3 to 8 line decoder with negative going outputs.

q       Enable the decoder IC at with signal CS0180* from the TDS9092.

q       Feed the 8 decoded outputs to the CS pins of the different LCDs.

Multiple Graphic LCDs

Multiple Graphic LCDs

The content of the variable #LCD determines which of the of the 8 LCDs will be affected by the LCD control words. This is initialised to 0 at power-up and can be set in the range 0 to 7. For example a value of 0 directs commands to an LCD at address 01C0, a value of 1 to 01C2, a value of 2 to 01C4 etc.

Go to Triangle Digital Support Home Page Go to top   Next page