This is only a preview of the May 1993 issue of Silicon Chip. You can view 51 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "A Nicad Cell Discharger":
Items relevant to "Build The Woofer Stopper":
Items relevant to "Remote Volume Control For Hifi Systems; Pt.1":
Articles in this series:
Articles in this series:
Items relevant to "Alphanumeric LCD Demonstration Board":
Articles in this series:
Articles in this series:
Articles in this series:
|
Alphan11meric LCD
Demonstration Board
Using an alphanumeric LCD panel is
not as hard as you may have thought. In
this article, we show you how to
interface one to a PC printer port.
By DARREN YATES
Over the last few years, the cost of
alphanumeric displays has dropped
dramatically. That's hardly surprising, considering they are being used
increasingly in consumer goods as the
push continues for "smart" appliances.
Most of these displays are controlled. by _microprocessors and are designed to make complicated equipment easier to operate. Items such as
microwave ovens, fax machines, CD
64
SILICON CHIP
players and car stereos now use alphanumeric panels to display options
and commands to help the user
achieve the desired result.
Alphanumeric LCDs are available
in many shapes and sizes but one of
the most cost-effective types is the 16
character x 2 line display that's used
here. It requires only 11 connections
- eight bits for data (which can be
reduced to four if necessary) and three
lines for control.
It runs off a SV DC supply and sells
for just $35, making it perfect micro- .
processor-controlled projects.
Circuit details
The LCD module contains two microprocessors and that's about all there
is to tell. These can be easily described
as the two black blobs on the back of
the PC board. Apart from the display
itself there's nothing else, it's that compact.
·
Fig.1 sh_o ws the simple circuitry
that goes with the display. As you can
see, it consists of a power supply
which uses a 78L05 lO0mA 3-terminal regulator to derive a regulated SV
rail. The power is derived from a 9V
300mA plugpack, while D1 provides
reverse polarity protection.
Since the display requires only
about lmA of current, this arrangement is more than adequate.
The display contrast is adjusted by
means of a 10k.Q trim pot which feeds
a voltage into pin 3 of the display.
Apart from that, all you need is a
male-to-male DB25 cable to connect
the display to the PC.
D1
1N4004
9VDC
300mA _ __
PLUG-PACK
VR1
10k
Programming
Normally, you would expect to see
these displays being driven from a
dedicated microcontroller but it's
quite easy to get the display to work
from your PC's parallel printer port.
That's because the display can be easily controlled by programming port A
for the eight data bits and port C for
the three control lines (note: port A
and port C are both part of the one
parallel port).
One thing that should be noted with
the printer ports is that the addresses
we've used for port A are 0378 hex
(888 decimal) and for port C, 03 7 A
hex (890 decimal).
All the pins for port A are noninverted; ie, if you set a particular bit
to "1", then that bit goes high. However, for Port C, we have used the
lower three bits and the first two qie
inverted; ie, to set them high, you
need to set that bit to "0", not "1".
The computer program takes care
of all this and you don't need to know
very much about computing to get the
display to work. For those who are
interested in how to program it, the
computer program contains documentation which shows the programming
sequence.
PARALLEL
PRINTER
PORT
(2) o o o - - - - - " - 1 1
vcc
VO
(3) 0 1 0 - - - - - a t
9
(4) 0 2 0 - - - - -at
2 ROW x16 CHARACTER
ALPHANUMERIC DISPLAY
AL TRONICS CAT.Z-7299
(5) D 3 0 - - - - - '10LI
11
(6) D 4 o - - - - ~-'1
(7) D5o-----'12at
13
(8) D 6 0 - - - - - - - 'at
(9) D 7 0 - - - - - - - ' -14af
RS R/W
4
5
E
GND
6
(1) S T R o - - - - - - - - - '
(14) A F O - - - - - - - - _ _ .
(16) 1 0 - - - - - - - - - - - '
(19-21) GND°"l-
0
I G0
VIEWED FROM
BELOW
ALPHANUMERIC DISPLAY
DEMONSTRATION BOARD
Fig.1: the circuit consists of the alphanumeric display module
plus a power supply which uses a 78L05 lOOmA 3-terminal
regulator to derive a regulated +5V rail. The eight display data
lines interface to port A of the parallel printer port, while the
three control lines interface to port C.
lr,
~·,25-PIN
D CONNECTOR
Instructions
OK, let's get down to the business
end of things. The first thing to look at
is the three control inputs to the display. They are REGISTER SELECT (pin
4), READ/WRITE SELECT (pin 5) and
OPERATION ENABLE (pin 6).
The REGISTER SELECT input controls whether you are writing an instruction to the on-board microprocessor (input set to O), or writing data
to be displayed on the screen (input
set to 1).
The on-board microprocessor allows for quite a few different effects,
such as shifting characters, scrolling
the display left or right, and defining
your own characters. We'll look more
closely at these special effects later.
The READ/WRITE select input allows you to read the current address
counter and the busy flag status. They
are not often used and are not re-
Fig.2: install the links (shown dotted) on the PC board before
mounting any of the other parts. The alphanumeric display is
connected to the PC board using a right angle pin header which is
soldered to the underside of the module.
quired to operate the display.
The OPERATION ENABLE input is
very much like the ENTER key on
your keyboard. This pin must be taken
high and then low again before the
instruction or data is entered in (ie,
the operation takes place on the negative going edge of the enable signal).
Table 1 is a quick reference chart of
the instructions and the corresponding code.
By using the printer port, you can
program the display in just about any
language you like, as long as it has an
instruction which allows you to send
data to the printer port registers.
Let's start by turning the display
on. To do this, we initially set port A
MAY
1993
65
RS
Clear Display
0
0
0
0
0
0
0
0
Cursor Home
0
0
0
0
0
0
0
0
Entry Mode Set
0
Notes
R/W 087 086 085 084 083 082 081 080
Parameter
0
0
0
0
0
0
*
1/D
0
DB1 =1: Increment
DB1=0: Decrement
DB0= 1: Display not shifted
s
DB0=0: Display shifted
Display on/off
0
0
0
0
0
Cursor/ Display Shift
0
0
0
0
0
System Set
0
0
0
0
Set CGRAM Address
0
0
0
Set DDRAM Address
0
0
Read Busy Flag/Address
Counter
0
D
C
B
DB2= 1: Display on; DB2=0: Display off
DB1 =1: Cursor on; DB1 =0: Cursor off
DB0=1: Blinking on; DB0=0: Blinking off
S/C
R/L
*
*
DB3=1: Shifts display one character
DB2= 1: Right shift; DB2=0: Left shift
N
F
*
*
0
DB4=1: 8 bits; DB4=0: 4 bits
Write Data
DL
BF
The maximum address length is 64
Add
The maximum address length is 80
AC
DB7 =1: Busy (instruction not accepted)
DB7=0: Ready (instruction accepted)
Read Data
to 12, which is DB3 and DEZ set high.
Port C is then set to 7 and then to 3 see Table 1.
Because the first two bits of port C
are inverted, we need to set them to 1
to get O's at the output. Setting this
port to 7 pulls the enable input of the
display high and then setting it to 3
0
0--0
Acg
Write Data
0
Read Data
0
DB3=1: 2-line display (1/16 duty cycle)
DB3=0: 1-line display
pulls it low again.
If we are using DOS 5.0's QBasic
programming language, the code looks
like this:
OUT 888,12
OUT 890,7
OUT 890,3
If you try this on a 486 machine,
0
:I
0
PC - Alpho.nuMerlc
dlsplo.y boo.rd
07106931
0
66
a
'--=~-=--=-=__,fllnmm
SILICO N CHIP
you might find that the change from
high to low produced by the last two
instructions might be too fast for the
microprocessor, so a small delay
should added in; eg, by using a
FOR .. .NEXT loop.
The display initially boots up in an
8-bit data 1-line mode, so we
can start entering characters
to be displayed o'n the screen
almost immediately.
One of the best features of
this display is that it accepts
standard ASCII code. This
makes it very simple and versatile to program as it matches
the code used in your PC.
For example, let's assume
that we want the words SILICON CHIP to appear on the top
0
0
Fig.3: check your PC board for
etching de(ects by comparing
it with this full-size pattern
before installing any of the
parts. The board measures 128
x 77mm (code 07106931).
PARTS LIST
Alphanumeric Display Board Demo Software
Copyright 1993 Silicon Chip Publications
1 PC board, code 07106931,
128 x 77mm
1 9VDC 300mA plugpack
1 DB25 female right-angle PCB
mount connector
1 3.5mm PCB mount socket
1 single way right-angle pin
header
2 5mm untapped spacers
2 3mm x 9mm machine screws
& nuts
4 rubber feet
1 10kQ trimpot
1 demonstration program
(LCD.EXE) - see below
COMMANDS
(1) Scroll the display right
(2) Scroll the display left
(3) Enter in text
(4) Create a character
(5) Turn cursor offi'on
(6) Enter in custom character
(7) Move cursor
(8) Clear display and cursor home
(q) quit Command:
Fig.4: this is the opening menu of the demonstration program LCD.EXE. By
selecting the appropriate number & pressing <enter>, you can enter in text,
scroll the display left or right, & create custom characters.
Capacitors
1 100µF 16VW electrolytic
1 33µF 16VW electrolytic
1 0.1 µF 63VW MKT polyester
Alphanumeric Display Board Demo Software
Copyright 1993 Silicon Chip Publications
12:-145
1
Semiconductors
1 2 .row x 16 character
alphanumeric display
(Altronics Cat. Z-7299)
1 78L05 5VDC 100mA regulator
1 1N4004 diode (01)
Where to buy the software
The demonstration program
LCD.EXE & the source code
LCD.BAS can be obtained by
sending $10 plus a formatted
5.25-inch or 3.5-inch floppy disc
to : SILICON CHIP, PO Box 139,
Collaroy Beach , NSW 2097.
♦
2
3
4
5
6
7
B
0
Move cursor using arrow keys & press <ENTER> to turn the point on/off
Press ESC to end editing
Fig.5: this on-screen display is brought up by entering <4> <enter> at the
opening menu. It allows you to create custom characters by moving the cursor
to a desired point using the arrow keys & then pressing <enter> to turn that
point on or off.
line. The ASCII code for an "S" is
either 83 decimal or 53 hex. We don't
have to program in hex so we can just
use the decimal code.
To display the "S", the code would
look like this:
OUT 888,83
OUT 890,6
FORD = 1 TO 10: NEXT D
OUT 890,2
Notice the difference between this
and the last section of code. Because
we are now entering data and not
instructions into the display, the REG-
!STER SELECT line is taken high (remember the inversion).
The FOR.NEXT loop adds in a delay to make sure that all lines have
settled into their final state before w e
enter the code.
The next letter to be entered is "I".
This has an ASCII code of 73 and is
entered in exactly the same manner
as the "S" except that we now substitute 7~. for 83.
Each character code is entered into
one of 80 memory locations to give
two lines of 40 characters. Because
only 16 characters per line can be
displayed at any one time, there is an
instruction which allows us to scroll
the display to either the left or the
right.
The code for shifting the display
one character to the right is 28, while
the code for shifting it to the left is 24
- see Table 1.
For this project, the basic rule is
that if you're entering a command,
then you must toggle port C (that's
address 890) to 7 and then back to 3. If
you're entering data into the display,
you have to toggle it to 6 and then
back to 2.
Each time you execute a shift command, the display is shifted one character in that direction. So in order to
scroll the display, you have to enter
the code in as many times as you wish
to move characters. If you do it indefiMA Y 1993
67
Alphanumeric Display Board Demo Software
Copyright 1993 Silicon Chip Publications
Alphanumeric
LCD Demo Board
* * note: first 16 characters only shown. * * press 'x' at line 1 to quit * *
Enter in data to be displayed on line 1: Alphanumeric
Enter in data to be displayed on line 2: LCD Demo Board
Text is entered by pressing <3> <enter> at the opening menu & then typing in
the required message. Note that the on-screen text window only shows the first
16 characters of each line, although up to 40 characters can be entered.
Alphanumeric Display Board Demo Software
Copyright 1993 Silicon Chip Publications
COMMANDS
(1) Scroll the display right
(2) Scroll the display left
(4)
(5)
(6)
(7)
(8)
Create a character
Turn cursor off/on
Enter in custom character
Move cursor
Clear display and cursor home
Alphanumeric
LCD Demo Board
(q) quit Command:
which of the five dots in that row are
to be on and off. Each bit that is set to
1 represents a dot that is on. Again,
each row data entry must be followed
by port C being fed with 6 and 2 to
enter it in. This means that it takes a
series of eight instruction sets to create one character.
This character is then stored in
memory and can be recalled for display by entering O through to 7 for
each of the eight characters; ie, OUT
888,0 for character 1; OUT 888,1 for
character 2, etc.
Construction
All of the components for the Alphanumeric Display Demo Board are
installed a PC board coded 07106931
and measuring 128 x 77mm.
Before you begin construction, make
sure that all the tracks on the PC board
are OK and that there aren't any defects such as shorts or breaks. If you
find any, use a small artwork knife or
a small blob of solder where appropriate to fix the problem.
The first job is to solder a 16-way
right-angle pin header to the edge connector of the display board - see photo.
This done, install the 3.5mm socket,
the 3-terminal regulator and other
components as shown in Fig.2. The
PC-mount DB25 socket can then be
installed on the board, followed by
the LCD module itself.
The top of the LCD module is supported on two 5mm spacers and secured using machine screws and nuts.
Use the mounting holes at the top of
the module as guides when drilling
the mounting holes in the PC board.
Software
Pressing the <enter> key after the second line of text has been entered returns
you to the opening menu. The text can be cleared by pressing <8> <enter>.
nitely, then the display will scroll
across the screen continuously.
Character generation
The display has a character set
which contains 240 different characters but for those who want to "roll
their own", there are eight custom
characters which can be programmed
into the display.
To make this easy, our demonstration program (LCD.EXE) has a character generation table built in which
allows you to turn any one of the 8 x 5
dots in the character on or off. The
68
SILICON CHIP
program then enters the data into one
of the eight special character RAMs.
To explain briefly how this works,
if you refer to Table 1 you will see the
instruction SET CGRAM ADDRESS.
After bit DB6 has been set high, you
can set the CGRAM address counter to
· one of 64 addresses. The first eight
addresses correspond to the eight rows
of the first character, the next eight
addresses to the eight rows of the
second character, and so on, up to a
maximum of eight characters.
Once a character address has been
set, the data then entered represents
As mentioned earlier, a demonstration program (LCD.EXE) plus the
source code (LCD.BAS) to go with this
project are available from SILICON CHIP
(see parts list for details).
LCD.EXE allows you to produce all
the effects described in this article
and is started by typing LCD<enter>.
The main command screen is then
displayed and this provides a menu
of all the possible commands. The
software is very straightforward to run
and requires no knowledge of how
the LCD panel works to get it running.
The source code provided runs under DOS 5.0's QBasic. Its main aim is
to give experienced programmers a
chance to customise the software to
suit their own requirements.
SC
|