LC7981/HD61830 Driver for EL Backlit Samsung LCD

I’ve found the time to post this LC7981/HD61830 driver (only graphics mode implemented) and some images of this Samsung LCD I’m using. I bought the LCD off of ebay ( http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&rd=1&item=230070938443 ) and shortly after I wrote the driver for it from scratch. I finished this driver about a month and a half ago, but I have just been too busy lately to post anything about it till now.

This is will eventually be a part of my GPS project, which I will get into later next week.

For now, here are the specs: an EL backlit 160×80 monochrome graphics LCD that supports text and graphics mode (I just coded for graphics mode and found a font/character pixel set online), controlled by an ATMega32. The LCD is driven by an LC7981/HD61830 controller (easy parallel interface). I’ll try to get the pinout up, including the EL connections with the inverter as soon as possible.

Pictures (no, I’m not running linux, the linux penguin just happened to be a convenient pixmap to demonstrate):
LCD Prototype Board
LCD Close Up Flash #2
LCD Close Up Flash #1
LCD Close Up Dark

And the free source, currently coded for the ATMega32 but can be easily adapted to other uCs: avr-lc7981.tar.gz.

Alternatively, feel free to browse the images and source here: http://www.frozeneskimo.com/samsunglcd/.

This entry was posted in AVR. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

19 Comments

  1. stue
    Posted January 20, 2008 at 2:16 am | Permalink

    I have the same LCD, probably i got it from the same guy on ebay,
    but never done with it anything, because couldn’t find EL backlight specs and inverter, where you got ours?

  2. Posted January 20, 2008 at 3:02 am | Permalink

    stue,

    The guy on ebay mentioned the inverter in the product description, so I searched around for it online. I remember it was almost impossible to find, but it turned out that it was packaged with this $10 16×2 EL character LCD from http://www.neonixie.com, which I ended up buying. I can’t find the character LCD on the neonixie store now… I guess the product went out of stock or they just pulled it completely. The pinout for the INV-TH-202 is pretty straight forward (in, out, ground).

    best of luck,
    ~vsergeev

  3. Bert
    Posted April 4, 2008 at 2:43 am | Permalink

    Hello,
    every time i try to compile your sources with WinAVR i get the following Errors. Here the error-File and the makefile

    Thanks Bert

    ——– begin ——–
    avr-gcc (GCC) 4.2.2 (WinAVR 20071221)
    Copyright (C) 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    Compiling C: LC7981.c
    avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./LC7981.lst -std=gnu99 -Wundef -MMD -MP -MF .dep/LC7981.o.d LC7981.c -o LC7981.o

    Compiling C: draw_penguin.c
    avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./draw_penguin.lst -std=gnu99 -Wundef -MMD -MP -MF .dep/draw_penguin.o.d draw_penguin.c -o draw_penguin.o
    draw_penguin.c: In function ‘draw_penguin’:
    draw_penguin.c:2: warning: implicit declaration of function ‘lcd_graphics_plot_pixel’
    draw_penguin.c:2: error: ‘PIXEL_ON’ undeclared (first use in this function)
    draw_penguin.c:2: error: (Each undeclared identifier is reported only once
    draw_penguin.c:2: error: for each function it appears in.)
    make.exe: *** [draw_penguin.o] Error 1

    > Process Exit Code: 2
    > Time Taken: 00:01

    Makefile:

    # MCU name
    MCU = atmega128

    # Processor frequency.
    # This will define a symbol, F_CPU, in all source code files equal to the
    # processor frequency. You can then use this symbol in your source code to
    # calculate timings. Do NOT tack on a ‘UL’ at the end, this will be done
    # automatically to create a 32-bit value in your source code.
    # Typical values are:
    # F_CPU = 1000000
    # F_CPU = 1843200
    # F_CPU = 2000000
    # F_CPU = 3686400
    # F_CPU = 4000000
    # F_CPU = 7372800
    # F_CPU = 8000000
    # F_CPU = 11059200
    # F_CPU = 14745600
    # F_CPU = 16000000
    # F_CPU = 18432000
    # F_CPU = 20000000
    F_CPU = 16000000

    # Output format. (can be srec, ihex, binary)
    FORMAT = ihex

    # Target file name (without extension).
    TARGET = LC7981

    # Object files directory
    # To put object files in current directory, use a dot (.), do NOT make
    # this an empty or blank macro!
    OBJDIR = .

    # List C source files here. (C dependencies are automatically generated.)
    SRC = $(TARGET).c draw_penguin.c graphics.c

  4. Abraham
    Posted April 25, 2008 at 12:30 am | Permalink

    hey man! Awesome Job! can you upload some of the circuits of how you connected the Atmega and the LCD? or some schematics?

    Thanks! :)

  5. Abe
    Posted April 25, 2008 at 1:29 pm | Permalink

    hey man, can you upload some the circuitry of how you connected your LCd to the Atmega?

  6. Posted July 3, 2008 at 12:43 pm | Permalink

    I have an old Hitachi LMG7402 with a 240×128 and I’ve been looking for a nice clean driver to hook it up to my AVR… Looks like I found it! Thanks for the code, I can’t wait to try it!

  7. Posted July 4, 2008 at 12:50 am | Permalink

    ALL,

    I’ve updated the archive to include a Makefile to compile this driver and driver test. The Makefile can also be found in the folder at http://www.frozeneskimo.com/samsunglcd/avr-lc7981-v1/Makefile .

    lc7981.c, lc7981.h, graphics.c, and graphics.h have also been updated to smooth out compilation. The code remains the same, but the includes at the top have been fixed up a bit to fix compilation with the new Makefile…

    Bert,

    almost ok, except that draw_penguin.c should not be compiled separately, it is included in lc7981.c and used in the main() function of lc7981.c…

    Abraham,

    (as i sent you earlier in private) here is a quick overview of the connections
    LCD pins:
    1-vcc
    2-gnd
    3-to lcd 17
    4- control signal
    5- control signal
    6- control signal
    7 to 14 – LCD’s data pins, connected to PORTB
    15-gnd
    16-vcc
    17-to lcd 3
    18-nc
    19-to the backlight inverter out
    20-gnd

    Richard,

    cool, glad to hear it, I hope everything works out… :)

    best of luck,
    ~vsergeev

  8. youtuber
    Posted July 9, 2008 at 1:14 pm | Permalink

    Looks cool, now rig it so you can stream a standard line out analog video signal from a video game system, id like to see a GTA (Grand theft Auto) Game displayed on one of these

  9. cornwallav8r
    Posted August 20, 2008 at 6:35 pm | Permalink

    Did you ever finish your gps project, and did you interface the 4-wire touch screen, I would love to see the code. Thanks

  10. Steve
    Posted April 9, 2009 at 1:14 am | Permalink

    Hi!

    First thanks for your good work.

    I’ve set up your driver with an atmega8. Control Port is set to PORTB, Data Port to PORTD. It seems to work so far, but the display shows just random pixels. :-(

    For testing my main() function in lc7981.c looks like this:

    int main(void) {
    lcd_graphics_init();
    lcd_graphics_clear();
    g_draw_rectangle(6, 5, 100, 30);
    while (1) ;
    return 0;
    }

    On every reset of the uC there’s another weird set of pixels on the display.

    Do you know what could be missing?

  11. Steve
    Posted April 9, 2009 at 1:29 am | Permalink

    Yeah! Now it works perfectly!

    Just a false set fuse bit/frequency.

  12. Frank
    Posted May 9, 2009 at 11:49 am | Permalink

    Hello,
    can you tell me how you the penguin convert? I will own pictures convert for this display.
    Thanks
    Frank

  13. Marc
    Posted May 26, 2009 at 9:41 am | Permalink

    Hi!

    I’m trying to get the lib running on a mega32 with ACR Studio.
    I’m having trouble with the penguin.xpm. I found one but there are about 1 million errors ;-)

    Can somebody help me out with a xpm-file?

    Thanks,

    Marc

    maw_hb@gmx.de

  14. Marc
    Posted May 26, 2009 at 12:40 pm | Permalink

    … it works! Thx Vanja for the great work!

  15. Posted May 26, 2009 at 5:52 pm | Permalink

    Frank,
    For my project, I exported the image as an xpm and then wrote a quick program (see xpm2code.c in the archive) is compiled with the xpm (with #include) and prints out a series of statements that I would save to another file, draw_penguin.c. This draw_penguin.c is then compiled into the firmware code, and will turn on the pixels at the right coordinates on the lcd to plot the picture.
    Thanks,
    ~vsergeev

  16. Posted July 29, 2009 at 1:01 am | Permalink

    vsergeev, can you send me the working penguin.xpm file? I thinkn i missed out that file thus compiling gives errors.

  17. Max
    Posted February 21, 2010 at 11:28 am | Permalink

    Hello,
    one year ago, I bought the same display and ported your code to a PIC 18F4580. This was an easy job because your code is very good portable!!! Thank you for this (it was my first project for an µC with C)!
    I’m telling because I had a break with 8biters and now I want to go back. So I searched my disk for the old projects and found this links again.
    BUT the only thing I wanna say is: THANKS for this great driver,
    Max

  18. Posted February 21, 2010 at 11:54 am | Permalink

    penguin.xpm posted: http://www.frozeneskimo.com/samsunglcd/avr-lc7981-v1/penguin.xpm
    I stripped the values/colors/pixels XPM lines to make it easier to read directly in the quick xpm2code.c program.

  19. z3r0c00l
    Posted April 6, 2010 at 10:44 am | Permalink

    hey,
    just wanted to say thx for this awesome piece of code! It almost worked out of the box, I just had to increase the busy wait value from 3 to 10 (everthing were very blurry with 3).
    I used a ATmega32 with the 8 MHz internal oscillator.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>