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
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:
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.
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
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" ( - )
MORE THAN ONE LCD
Multiple Alphanumeric LCDs
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.