This document is available in: English Castellano Deutsch Francais Italiano Nederlands Russian Turkce Korean |
by Guido Socher About the author: Guido is a long time Linux fan. His Linux home page can be found at www.oche.de/~bearix/g/. Content: |
Abstract:
This article shows how to use the BLC2021 PC-Bay Insert serial line display from Matrix Orbital under Linux. The BLC2021 is a small dot matrix LCD display which is very easy to use and does not require any additional controller chip or complicated driver.
With some hobby building skills you can use your old PC to build an MP3 player for your living room or to control the central heating in the house or just use it as an intranet server. The use cases are probably manifold. In all of these cases it would be nice to have the computer inside a small metal box without a big monitor and keyboard around. Instead you would like to have a small LCD display which shows the title of the current song on the MP3 player, the temperature for your heating control system or the status of your server.
The LCD displays form matrix-orbital are ideal for such applications.
LCDs and computer electronics in general are rather sensitive things. Connecting an LCD display backward to power supplies or too high voltage can easily destroy the display. We present in this article the BLC2021 serial line PC bay insert because it is very easy to install and comes with all the cables needed to plug it into your computer. All you need to install the BLC2021 is a small screw driver. With the ready made cables and connectors that come with the BLC2021 there is not much that can go wrong.
The BLC2021 comes with all the needed cables and fits into a 5.25 Inch PC-bay. You need to connect the power supply to the computers internal power supply and the flat-band cable to a RS232 serial port. One possibility to do this is to go out with the cable on an empty slot position at the back of your computer and connect it to the external RS232 connector.
Matrix-orbital provides driver software on a floppy disk.
It contains lcdproc-0.3.3
for Linux. It is GPL software and available as source code on
the floppy. However the lcdproc-0.3.3 is written for 4 line displays
and the BLC2021 has only 2 lines. Therefore you will only see
a flickering display.
More recent versions of lcdproc seem to be usable with
two line displays but I have not tested it.
lcdproc was written
to display periodically
system information such as uptime, memory usage, etc..
In this article we will not use lcdproc.
We present a more general way of writing information
to the display. Using the display is very simple and you don't actually
need complicated driver software for Linux. All you need to do is
to initialize the serial line correctly and then you can
even use a shell script to drive the LCD display. The rest of this
article explains how to do that.
Now the display is ready to use. Here is a little example of a perl script that displays a counter counting up every second:
#!/usr/bin/perl -w open(LCD,">/dev/lcd")||die "ERROR: can not write to /dev/lcd\n"; $|=1; my $i=0; while(1){ $i++; print LCD chr(0xFE),"X"; # clear the display print LCD "Count $i\n"; sleep(1); } close LCD; |
As already described one option to write system info such as swap memory usage, uptime and load to the display is to use lcdproc.
Another option is to use the mtxorb program from above and then write again a small perl script. You can read uptime from /proc/uptime swap usage from /proc/meminfo and cpu load from /proc/loadavg. This is exactly what this perl script called lcdwriter (click here to download) does. As it is just a script it is also very easy to customize and modify for display other things than just swap, uptime and load.
|
Webpages maintained by the LinuxFocus Editor team
© Guido Socher, FDL LinuxFocus.org Click here to report a fault or send a comment to LinuxFocus |
2001-01-27, generated by lfparser version 2.8