EDN Access

 

September 12, 1997


Low-cost LCDs implement bar-graph displays

Sergio Zigras, Paramus, NJ

You can easily implement LCD bar-graph displays in cost-sensitive designs by using widely available, low-cost, alphanumeric LCDs. Bar-graph displays indicate voltage, current, power, battery and fuel gauges, and sound level (in decibels), for example. The method uses a 16-character-by-one-line, 5×8-dot LCD. In general, all dot-matrix alphanumeric LCDs, such as one line by 16 characters or four lines by 20 characters, have identical features except for their size and dot-character parameters. These displays incorporate RAM (called the character-generator (CG) RAM) for eight user-defined characters.

This bar-graph display (Figure 1) uses only 3 bytes, but you could use all 5 lines for better resolution. In that case, you would use 5 bytes of the available user RAM instead of 3, and the translating algorithm would become longer (Figure 2). Alternatively, you could use a two-line LCD: the top line for alphanumeric data and the second line for a bar-graph display. You can obtain the LCD initialization and support routines, as well as the user-defined character-generation methods, from the LCD manufacturer (such as Optrex Corp, Torrance, CA).

This example displays current in milliamps. It uses 48 bars (16 characters×3) and defines each bar to equal 3 mA. The total displayed current is 48×5=240 mA. The variables and constants in the flowchart are MA for the current sample, S_BAR for the single-bar byte, D_BAR for the dual-bar byte, and T_BAR for the triple-bar byte (Figure 2). These are the user-defined characters stored in the CG RAM. The 16-character counter is CNTR, the 15-unit parameter is UNIT_15, the 10-unit parameter is UNIT_10, and the five-unit parameter is UNIT_5. These parameters represent 15, 10, and 5 mA. (DI #2078)


Figure 1
18D20782
Low-cost alphanumeric LCDs lead a dual life and make ideal elements for implementing bar-graph displays.
Figure 2
18D20781
Using the algorithm in this flowchart, you can use an alphanumeric LCD's user-accessible RAM to implement a 0- to 240-mA bar-graph display.

| EDN Access | Feedback | Table of Contents |


Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc.