|
||
LIQUID CRYSTAL DISPLAYSALPHANUMERIC DISPLAYSThe following words for alphanumeric LCD displays are inside the Forth ROM.
GRAPHICS DISPLAYSThe following words for graphics LCD displays are in the file _G61830.TDS.
FILESApart from the built-in support for alphanumeric displays, the following files have software for use with Liquid Crystal Displays:
HARDWARELiquid 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 Graphic LCD connections to TDS9092
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 SOFTWARESupport 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" : "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 SOFTWARESupport 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.
MORE THAN ONE LCDUp 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.
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.
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. |