RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Discover a New Frontier for .NET Development: Program an LCD Display

Personal computers aren't the only place where applications can run. As we look toward the future, the possibilities are limitless for creating applications that manipulate other types of displays. Get started with this sample .NET application that controls an LCD display.

ne of the most fascinating aspects of programming is making things work. And that is not limited to just what you can do with your computer; a much more exciting world exists outside of the computer. In this article I will show you how to add a cool and interesting secondary display to your computer. In particular, you will learn how to connect to a LCD display and use .NET to display information on it.

For this article, I will use the 4x20 Serial LCD (model LK204-25; this LCD is manufactured by Matrix Orbital and sold by Parallax) with Keypad Interface from Parallax ($99.95; see Figure 1). LCD displays have been used in a wide variety of electronic devices. The next time you use your credit card at the shopping mall, take a good look at the terminal (see left of Figure 2); you'll almost certainly find that it is LCD. Besides being embedded in electronic devices, LCD screens are increasingly getting the attention of modders, who like to embed them in drive bays and use them to display system information (see right of Figure 2).

Most LCD screens in the market mainly come in two types of interfaces: parallel and serial. Technically, all LCD screens use parallel interfaces. However, due to the complexity of wiring and programming, some manufacturers add circuits to convert the parallel interface into a serial one. The end result is fewer wires to connect and a much simpler way of programming.

Figure 1. Parallax's 4x20 Serial LCD with Keypad Interface is the target device for the examples in this article.
Figure 2. LCD screens are used in credit card terminals and drive bays.

For this article, I used the serial version of the LCD with the new SerialPort class available in .NET 2.0. This makes programming an application much simpler and allows me to concentrate on exploring the features of the LCD.

Setting Up the LCD Display
The first step is to connect the LCD display to your PC. In order to do so, you need to perform a TTL-to-RS-232 level shifting so that the data can be read via a serial port. One way is to connect the LCD display to Parallax's RS-232 DCE AppMod (http://www.parallax.com/detail.asp?product_id=29120; $29; see Figure 3).

For this project, however, I chose to use the Javelin Demo Board ($119; see Figure 4) to connect to the LCD display.

Figure 3. The RS-232 DCE AppMod is an economical option to perform the level shift to a serial port.
Figure 4. The Javelin Demo Board is shown.

Tip: Either board will work well. The advantage of the Javelin Demo Board is that you can connect a 5-volt DC supply to the board and the LCD display can draw the voltage directly from the board. However, it is the more expensive option. If you are a modder, you can wire up the reader yourself using an RS232 level shifting integrated circuit. Also, check out the Basic Stamp 1 Serial Adapter.

Figure 5 shows the wiring on the back of the LCD display. Be careful not to reverse the connection of the +5V and Ground connectors. The Rx connector allows data/instructions to be sent to the LCD display while the Tx connector allows data to be read from the LCD display. In most cases, you can simply connect only the Rx connector since all you want is to send data to the LCD.

Figure 5. The connections on the back of the LCD display are shown.
Figure 6. The Javelin Demo Board connections are shown.

Figure 6 shows the connections on the Javelin Demo Board. Remember to use a straight serial cable to connect your PC to the board. As shown in the figure, line 3 of the serial port is connected to the Rx connector of the LCD. Line 2, which connects to Tx, is optional.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date