Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Hardware support
Alphanumeric LCDs
Live website search
Enter key words
 

ALPHANUMERIC LCDS

DEFINITIONS

#LCD

( - a )

User variable defining one of 8 LCDs (0 to 7)

'EMIT

( - a )

User variable vectoring EMIT

'PUT

( - a )

User variable vectoring PUT

0AT

( - )

Zero position pointer AT

<PUT>

( c n - )

PUT uses this for most LCDs

AT

( - a )

User variable containing character position.

AWAIT

( - )

Delays until LCD free. Used by PUT etc.

DISPLAY-SET

( blink cursor, on/off - )

(#EXTEND.TDS) Sets these parameters

HOME-CURSOR

( - )

Cursor goes to first 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

PRIME

( blink cursor, on/off, sh, id, lcdkind - )

Initialise LCD. See text below.

PUT

( c n - )

Puts character c at position n on LCD

SHIFT

( r/l s/c - )

Moves message and/or cursor left or right

 

 

r/l: 1=right shifts  0=left shifts;

 

 

s/c: 1=shift cursor+message  0=shift cursor

WIPE

( - )

Blanks LCD

FILES

#CURSOR.TDS

Cursor movement etc. on alphanumeric LCDs

#LM018.TDS

Corrects character positioning on 2 line LCDs

#LM041.TDS

Corrects character positioning on 4 line LCDs

#LM087.TDS

Corrects character positioning on 16 x 1 LCD

#EXTMESS.TDS

Packed message strings stored outside dictionary

#MESSAGE.TDS

Packed message strings with index

HARDWARE

Liquid Crystal Displays (LCDs) go well with TDS2020F. They have low power consumption, interface directly and software is built in. Any alphanumeric Liquid Crystal Display that has a HD44780 chip in it can be used and most are electrically interchangeable. This includes displays from Hitachi, Epson, Sanyo etc. They range in size from 16 characters on one line, to 4 lines of 20 characters.

Alphanumeric LCD connections

Alphanumeric LCD connections
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 CU20025ECPB-U1J from Noritake Itron is a 2 x 20 character fluorescent display module that can be used as a drop-in replacement for an Hitachi LM091XMLN LCD (or equivalent). No software changes are required, and hardware changes are minimal. Pin 3 (normally used for contrast adjustment on the LCD) is left open circuit. The +5V supply to pin 2 must be external to the TDS2020F, as the current required exceeds the capacity of its on-board supply. Fixing centres are identical. This fluorescent display is one of a range from Noritake Itron. Sizes range from 2 x 16 to 2 x 40 characters.

If you want a 40 x 16 character display would you think of using a graphics LCD module? Most graphics LCDs also have a mode which uses an internal character generator, relieving the TDS2020F of the burden of generating them in software. For example Hitachi's LMG7400PLFC gives 16 lines of 30 characters. Note that graphics displays based on the Toshiba T6963 controller can be used simultaneously in character and graphics modes.

Some available display sizes are:

 

q                   80 x 32 pixels

13 x 4 characters

q                   240 x 128 pixels

40 x 16 characters

q                   320 x 64 pixels

53 x 8 characters

q                   640 x 64 pixels

80 x 8 characters

 

The diagram shows how a TDS2020F connects to an alphanumeric display. The pin numbering on other manufacturers' displays is often the same but it must be checked-it may be different.

The resistor and potentiometer provide a bias that governs contrast. The resistors shown on the data bus lines are needed only when a keypad is fitted. From experience displays from Densitron and RS Components need lower resistor values, try 2k2.

ALPHANUMERIC SOFTWARE

Support routines for alphanumeric displays are built into the TDS2020F.

Use PRIME to automatically put the LCD through its initialisation sequence. For example, suppose we have a display with 2 lines of 24 characters, each a 7 x 5 dot matrix. The following may give the characteristics required:

 

: INITIALISE ( - ) \ Part of initialisation on power-up

   0              \ cursor should not blink

   1              \ a cursor is required

   1              \ display to be visible on at power-up

   0              \ display will not shift as it is written

   0              \ character address to not auto-increment

   $38    \ sets 2 line display, 7 x 5 characters

   PRIME ;        \ set up the display ready for use

 

After entering the definition as above, type INITIALISE and return to get the display ready for use.

To calculate the required number for the kind of LCD used (second line from the bottom above) 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. Even a one-line 16-character display is normally electrically 2 lines of 8 characters. 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 to 79 on the lower. Use files such as #LM041.TDS and #LM087.TDS as models to correct this positioning. They 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 <EMIT> that writes to the serial line. Suppose we want messages like 'Move right by 23.45 metres.' The basic text can be coded and displayed as follows:

 

: <LCD ( - ) \ Revector EMIT to use LCD
   'EMIT @ R> 2>R ['] LCDEMIT 'EMIT ! ;
: LCD> ( - ) \ Restore vector
   2R> >R 'EMIT ! ;
: "START" ( - ) WIPE <LCD ." Ready to start" LCD> ;
: "GOING" ( - ) WIPE
   <LCD ." Move       by       metres" 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" 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 KEY?
   UNTIL ; \ stop on any key

MORE THAN ONE LCD

Multiple Alphanumeric LCDs

Multiple Alphanumeric LCDs
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.


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

 

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 CS81C0 from the TDS2020F.

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

 

The content of the variable #LCD determines which 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 81C0, a value of 1 to 81C2, a value of 2 to 81C4 etc.

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