Silicon ChipDemonstration Board For Liquid Crystal Displays - February 1998 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Deflation has been with us for a long time
  4. Feature: Surplus Mania: Hot Web Sites For Bits by Adrian Cuesta
  5. Feature: Understanding Electric Lighting; Pt.4 by Julian Edgar
  6. Project: Multi-Purpose Fast Battery Charger; Pt.1 by John Clarke
  7. Project: Telephone Exchange Simulator For Testing by Mike Zenere
  8. Project: Command Control For Model Railways; Pt.2 by Barry Grieger
  9. Order Form
  10. Product Showcase
  11. Serviceman's Log: The TV set that smoked by The TV Serviceman
  12. Project: Demonstration Board For Liquid Crystal Displays by Rick Walters
  13. Project: Build Your Own 4-Channel Lightshow; Pt.2 by Leo Simpson & Rick Walters
  14. Vintage Radio: Clean audio for old Henry by John Hill
  15. Feature: Radio Control by Bob Young
  16. Book Store
  17. Feature: Computer Bits by Jason Cole
  18. Market Centre
  19. Advertising Index
  20. Outer Back Cover

This is only a preview of the February 1998 issue of Silicon Chip.

You can view 29 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.

Articles in this series:
  • Understanding Electric Lighting; Pt.1 (November 1997)
  • Understanding Electric Lighting; Pt.2 (December 1997)
  • Understanding Electric Lighting; Pt.3 (January 1998)
  • Understanding Electric Lighting; Pt.4 (February 1998)
  • Understanding Electric Lighting; Pt.5 (March 1998)
  • Understanding Electric Lighting; Pt.6 (April 1998)
  • Understanding Electric Lighting; Pt.7 (June 1998)
  • Understanding Electric Lighting; Pt.8 (July 1998)
  • Electric Lighting; Pt.9 (November 1998)
  • Electric Lighting; Pt.10 (January 1999)
  • Electric Lighting; Pt.11 (February 1999)
  • Electric Lighting; Pt.12 (March 1999)
  • Electric Lighting; Pt.13 (April 1999)
  • Electric Lighting, Pt.14 (August 1999)
  • Electric Lighting; Pt.15 (November 1999)
  • Electric Lighting; Pt.16 (December 1999)
Items relevant to "Multi-Purpose Fast Battery Charger; Pt.1":
  • Multi-Purpose Fast Battery Charger PCB patterns (PDF download) [14302981/2] (Free)
  • Multi-purpose Fast Battery Charger PCB pattern (PDF download) [14302981] (Free)
  • Multi-purpose Fast Battery Charger panel artwork (PDF download) (Free)
Articles in this series:
  • Multi-Purpose Fast Battery Charger; Pt.1 (February 1998)
  • Multi-Purpose Fast Battery Charger; Pt.2 (March 1998)
Items relevant to "Command Control For Model Railways; Pt.2":
  • Model Railway Receiver/Decoder Module PCB patterns (PDF download) [09105981/2] (Free)
  • Model Railway Command Control PCB patterns (PDF download) [09102981/09103981] (Free)
Articles in this series:
  • Computer Bits (December 1989)
  • Command Control For Model Railways; Pt.1 (January 1998)
  • Command Control For Model Railways; Pt.2 (February 1998)
  • Command Control For Model Railways; Pt.3 (March 1998)
  • Command Control For Model Railways; Pt.4 (May 1998)
  • Command Control For Model Railways; Pt.5 (June 1998)
Items relevant to "Demonstration Board For Liquid Crystal Displays":
  • LCD Demonstration Board PCB pattern (PDF download) [04102981] (Free)
Items relevant to "Build Your Own 4-Channel Lightshow; Pt.2":
  • 4-Channel Lightshow PCB patterns (PDF download) [01112971/2] (Free)
  • 4-Channel Lightshow panel artwork (PDF download) (Free)
Articles in this series:
  • Build Your Own 4-Channel Lightshow; Pt.1 (January 1998)
  • Build Your Own 4-Channel Lightshow; Pt.2 (February 1998)
Articles in this series:
  • Radio Control (January 1998)
  • Radio Control (February 1998)
  • Radio Control (March 1998)
  • Radio Control (April 1998)
Articles in this series:
  • Norton Utilities V2: hard disc maintenance for your PCs (January 1998)
  • Computer Bits (February 1998)
  • Computer Bits (March 1998)

Purchase a printed copy of this issue for $10.00.

Demo board for liquid crystal displays Ever wondered how an alphanumeric liquid crystal display translates digital data into a readable message? Then wonder no more and build this neat little demo project which uses a one-line alphanumeric LCD. By RICK WALTERS These days almost every electronic doodad seems to have an LCD in it. From those horrible little Tamagochi hand games to the ubiquitous bat phone (What? You still call yours a mobile?) to photocopiers and faxes, they’re everywhere. However did we func­tion without LCDs? Maybe life was simpler then . . . Anyway, how do these LCDs work? Most LCDs are not just the bare liquid crystal display with a whole bunch of connections made via an elastomeric connector to an external circuit. In­ stead, most one and two-line alpha60  Silicon Chip numeric displays have a proces­sor encapsulated in a blob of black plastic on the back. Alterna­tively, the processor might be a surface mount device on the back of the display. Either way, the principle of operation is much the same. Parallel 8-bit data is fed in on a bus and this is converted by the processor to be displayed. Before we go any further, we had better define what we mean by “alphanumeric”. This merely means that the display can handle alphabetic and numeric characters; ie, numbers and letters. More to the point, most alphanumeric displays can handle most of the 256 characters possible in the ASCII character set. Typically they can display all upper case and most lower case letters, numbers, punctuation marks, mathematics symbols such as plus, minus, division, percentage, greater than, less than and so on, some Greek symbols, the dollar sign, asterisk, hash and perhaps some Kanji symbols from the Japanese language. For this demo project we have used an LCD employing the very common Hitachi HD44780 LCD controller chip. It converts the 8-bit data into characters employing a 8 x 5 dot matrix. This same dot matrix, by the way, is used in cheap dot matrix print­ers. Obviously then, the on-board processor does a translation (decode) between 8-bit ASCII characters to an 8 x 5 dot matrix display, as well as providing the buffer to display a full line of characters. As you can see, the demo project Fig.1: the circuit uses eight switches to load binary data into the LCD controller. IC1 is used to debounce the LOAD switch S10. consists of the chosen LCD panel together with a row of 10 switches on it. Eight of the switches are for setting the 8-bit data, while the other two are for actually loading the data into the display. There are some other bits on the board as well but we’ll come to those later. Now you might think at this stage that this project is not all that practical, particularly if you are thinking of loading in long messages by hand! You’d have to be working all those switches like a veritable whirlwind if the message was to be displayed in a reasonable time. No, that is not the purpose of the project. It is merely a learning tool which will give you some knowledge of how ASCII characters are displayed onto an 8 x 5 matrix. It will also be useful if you are beginning to write soft­ware to drive a display with a microprocessor or the parallel port of a computer, as it allows you to check that the function you are coding does actually work as intended. As you can see from the circuit of Fig.1, apart from the switches and the LCD panel itself, there are a few resistors, three capacitors, a voltage regulator, a 7555 CMOS timer and a battery to get the display working. Keen-eyed readers will have also noticed an 8-way DIP switch on the board but that is there as a cheap alternative to the individual toggle switches. The DIP switches are more diffi­cult to use if you want to load in a lot of data but they could be a practical alternative if you envisage using this project just to display one message. As I am writing this article I am absolutely devoid of ideas on what such a message might be, but I am equally sure there will be heap of uses out there. Mind you, there are two drawbacks to using the 8-way DIP switch to replace the logic level input switches S1-S8. For a start, the DIP switches are much more difficult to set. Second, the data must be entered backwards as the most significant bit is on righthand side of the switch, whereas binary numbers are conventionally written from left to right with the most signifi­cant bit on the left. Makes it a bit tricky, eh? On the other hand, some readers seem to thrive on a challenge. For those readers who want the easier life, the convention­ al toggle This photograph shows the old display at top with the “black blobs” and the new display with the HD44780. February 1998  61 Fig.2 (left): the component overlay shows all 11 toggle switches and the alternative 8-way DIP switch. Fig.3 (below): actual size artwork for the PC board. switches are laid out to accept conventional data. How it works There are two types of information which the controller chip can accept: commands and data. A command is an instruction which tells the controller to do something internally, such as set an 8 or 16-character display, home the cursor, clear the display etc. Data consists of the character or characters we wish to show in the display window. These instructions are differentiated by the logic level on pin 4 (register select). This pin is taken low (ground) to input a command and high (5V) to input data. The value of the input is set, in 8-bit binary, by the switches D0 to D7 (or the DIP switch). Once the value is entered it is transferred to the display by taking pin 6 (enable) low. So what is the reason for the 7555 timer IC? Why not con­nect the switch directly to pin 6 of the display and save on the cost? If you did this you would be very disappointed with the result. The first character you entered would probably fill the entire display due to the switch’s contact bounce. When a switch is actuated it never just closes. As the contacts make, their momentum causes them to “bounce” apart, then make, then bounce. This can continue for 30ms or so. When you turn on a light or a jug, 62  Silicon Chip the bounce doesn’t matter but as the display only takes 40µs to process the instruction, it sees each bounce as a new instruction and will write the character over and over. The capacitor fitted across the switch is discharged on the first “make” and cannot rapidly charge through the 470kΩ resis­tor. This time constant of 47ms ensures that the logic level cannot go high again until the switch contacts stop bouncing. OK but why use the 7555? Couldn’t the junction of the resistor and capacitor go directly to pin 6? The answer is yes but then the transition time of the waveform would be too slow around the switching threshold of the HD44780 and there is the possi- bility of at least two characters being written. The IC output has very fast rise and fall times which are more suited to the display characteristics. Don’t forget, the display was designed to be driven from a microprocessor. Pin 5, the read/write pin, is tied permanently low as, with this simple setup, we cannot read information from the display. VR1, the 10kΩ contrast control, is necessary as its optimum setting varies depending on the display length, duty cycle or character mode. We’ll talk more about this aspect later. Building the PC board The first step is to check the PC Table 1: HD44780 Instructions good contact with its respective gold-plated contact. This approach allows you to easily remove the display and use it in other projects. You will need to check continuity from each pin to the display pad to ensure that they are all making contact. Check that the polarity of the electrolytic capacitor is correct and that the DIP switch is fitted facing the right direc­tion. Also double check that the battery leads are soldered into the correct pads before you connect the battery. Lastly, fit a self-adhesive foot to each corner of the PC board to prevent it from sliding around while you are setting the switches and also to protect any surface it may be placed on. Testing the display pattern against the art­work of Fig.3, ensuring that the tracks between the switch pads don’t short and that none of the tracks are broken. Any necessary repairs should be done now. To keep the cost low we have screened the switch informa­tion on the top of the PC board as there seems little point in putting it all in a case. The first step is to fit and solder the four links as shown on the component overlay diagram of Fig.2. Next, fit and solder the resistors, trimpot, IC, capaci­tors, pin header, regulator, battery clip, then lastly the switches, making sure that the spring- loaded toggle is fitted at the righthand end of the board and the switch action is towards the 7555 timer. The centre pin of the regulator will have to be bent away from the flat to fit the PC board. We have specified a 14-pin strip to connect the display pins to the PC board. There is no need to solder the pins to the display board – just bend them slightly so that each makes Turn the contrast control VR1 fully anticlockwise, plug in the battery and turn the power on. Eight dark rectangles should show at the left half of the display. When power is applied the controller initialises an eight character display and these are what you can see. The contrast control should now be turned clockwise until these rectangles just disappear. Before we can do any further testing we need to give just a short burst on binary numbers. We are all used to dealing with decimal (power of 10) numbers which have 10 digits (0-9). As the name suggests, binary (power of two) numbers have just two digits (0 & 1). We use the switches S1-S8 to select either of these values, a zero being a low logic level and a one being a high logic level. There are eight input switches, so to define the position of each switch February 1998  63 Table 2: Character Codes vs. Character Patterns (hence each input instruction) we issue a string of eight binary digits (or bits), always starting with bit 8. For example, the command for ‘turn display and cursor on, with cursor position underlined’ is 00001110. This means S1 and S5-S8 would be turned off (down) while S2, S3 and S4 would be turned on (up). This was done to match the DIP switch which is up for on. All the commands are shown in Table 1. As it is quite difficult to speak and think in binary, most people prefer to use decimal, or if you are a computer boffin, then you must talk Hexadecimal (power of 16) which uses the digits 0-9, then A-F for the next six. The table also shows these values. Now back to the testing. If you set the switches to 00001110, the func64  Silicon Chip tion switch to command (CMD) and actuate the LOAD switch, an underline will appear at the first position. So the code actually worked. If you are using the DIP switch 2, 3 and 4 would be ON, the rest OFF. Table 3: User Designed Character Binary Decimal H ex 0000 1110 14 E 0000 0000 0 0 0001 1011 27 1B 0000 0100 4 4 0000 0100 4 4 0001 0001 17 11 0000 1010 10 A 0000 0100 4 4 OK, now let’s do something a little more useful and enter some data. The fist step is to switch S9 from command to data. Keeping it simple, we will enter the characters A-P. The 8 bits for each letter of the alphabet, as well as all the characters the display is capable of, are shown in Table 2. Set the capital A, 01000001, and load it with S10. Hopefully an A will display and the cursor will step to the next position. Continue to enter the letters. What happened to I? A 16-character display with only eight characters is not much use. This is the difference between early displays similar to the one used in the SILICON CHIP article in May 1993, which had a continuous address space for the sixteen characters. The old style displays (see photo) had two black blobs on the PC board, which have been replaced by the HD447870. Unfortunately, but for compatibility reasons, it has the addresses of the first eight characters from 0 to 8 but the second eight characters from 64 to 71 decimal (40H to 47H). Now let’s try again. We must set the display for 16 charac­ters. Set the switches for 00111000, the function switch to command and load the instruction. The contrast control will need to be reset slightly for optimum viewing as the duty cycle has changed. Load 00000001 to home the cursor and clear the screen, then change to data and begin loading the alphabet again. This time after you load H the cursor will disappear. Using COMMAND and 01000000 will restore the cursor, but when you try to enter characters the cursor steps but writes blanks. Use 01000000 and command to bring it back to position 9 then load command 11000000. Now when you continue entering the alphabet all is well. Look up these last two commands in Table 1 to see what they actually did. Moving the text Up until now we have stepped the cursor forward each time we entered a character but it is also possible to keep the cursor stationary and move the text either to the left or to the right. Again from Table 1, the command for “shift left” is 000011000 and “shift right” is 00011100. As we saw previously, if you enter more than eight charac­ters starting from position 1, they don’t appear on the display. They are still being stored in RAM though and can be moved back­wards and forwards in the display window by using either of the above instructions in command mode and loading it. Try it for yourself. The only thing left to do now is to create our own symbols. Up to 16 custom symbols can be stored in CGRAM but they must be loaded each time the display is powered up. This is because they are stored in static RAM and they are lost when power is removed. If you were using a micro it would be easy to load them at each power up. Symbol creation If you look closely at the display, with the contrast ad­justed to see the black rectangles, you will observe that the characters are made up using an 8 high by 5 wide dot matrix. Each of these dots (pixels) is addressable and this is why we can create our own symbol. To program a symbol the first step is to draw it on the righthand side of an 8 by 8 grid (see Table 3). The lefthand three digits are always zeros. The Parts List 1 PC board, code 04102981, 127 x 77mm 1 one-line Liquid Crystal Display with HD44780 controller 10 SPDT toggle switches or 2 SPDT toggle switches and 1 8-way DIP switch (see text) 1 SPST spring-loaded toggle switch (S10) 1 78L05 5V regulator 1 9V battery 1 battery snap connector 1 14-way pin strip 4 2.5 x 15mm machine screws 12 2.5 mm nuts 4 12 x 12mm adhesive rubber feet Capacitors 1 100µF 16WV PC electrolytic 1 0.1µF MKT polyester 1 0.1µF monolithic ceramic Resistors (0.25W, 1%) 1 470kΩ 8 15kΩ 1 20kΩ PC trimpot (VR1) choice is limited but we shall draw a crude smiley face. Clear and home the display then set the address to 01000000 and load it. Change to character and load the eight binary numbers starting from the top (00001110). After the eighth has been entered, switch to command and clear the display. Switch back to data and write 01000001 which should be a capital A (just to check everything is still working), then write 00000000 which will display our face. The first saved symbol is stored in location zero (even though we wrote it at position 64, and the next fifteen are saved in loca­tions 1 to 15. This is shown in Table 2. Well, that covers the capabilities of this simple display. It can’t show 10 by 5 or true lower case characters, but the knowledge you have gained will apply to multi-line and 10 x 5 displays. Computer control Next month, we will use this same LCD panel in a project which can be driven from a PC’s parallel port. It won’t be so much of a learning experience but it is a heck of a lot quicker SC to get a readable message. February 1998  65