liblcd version 1.0.3
Copyright 1999, 2000 by Nathan Anderson, ALL RIGHTS RESERVED
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library (in a file called "COPYING"); if not, visit
or write to:
Free Software Foundation, Inc.
59 Temple Place, Suite 330
Boston, MA 02111-1307 USA
***************************************************************************
liblcd is a simple Linux user-space driver for RS232-driven LCD
alphanumeric and graphical displays. It is more tailored to the specific
model of LCD I'm using (Scott Electronics SGX-120L / G12032,
; it is a graphical display), but it should work
with most any LCD that can understand ASCII. Many of the codes are the
same on the different serial LCDs (though slight subtleties and big
differences exist...it depends upon how the model of the display
implements its functionality). Even if your display is not a graphical
one, you should be able to take advantage of the text functions.
The driver can either be statically linked to your project...
$ gcc -o project project.c liblcd.o
...or it can live as a shared library and dynamically link to your
project...
$ gcc -o project project.c -llcd
You must lcd_open( ) the special device you wish to use, and then
lcd_init( ) the display. After that, you can lcd_write( ) to the buffer
and then lcd_flush( ) to send the buffer to the LCD. Or, if you just wait
for the 255-character buffer to fill up, it will flush itself. When you
call lcd_open( ), it takes two parameters: the first one is a 'string'
(pointer to a char array) which contains the path to the device file that
corresponds with the serial device that you have your LCD display
connected to (/dev/ttySx), the second one is a speed_t which refers to
the baud rate and must be either B2400 or B9600. lcd_init( ) takes one
parameter (a char) which specifies what settings you would like to have
enabled or disabled at the beginning. You should use the bitwise OR (|)
operator to toggle these options on or off when calling lcd_init( ).
There are currently three possible settings: CLEARSCR (clear the screen),
INVERSETXT (white-on-black text), and BACKLIGHT (turn backlight on).
Example: lcd_init( CLEARSCR | BACKLIGHT ); would clear the screen and turn
the backlight on when the display is being initialized.
Use the included Makefile to build the library. Running 'make' will build
an object file that can be statically linked. If you wish to make a .so,
then run 'make install' (as 'root') which will build and install the
shared library version for you.
I apologize for the sparse documentation. In the (hopefully) near future
I hope to make up for that. In the meantime, if something isn't obvious
to you, feel free to contact me at .
-- Nathan Anderson