Shop OBEX P1 Docs P2 Docs Learn Events
Yet Another LCD Driver Object (V1.3 14-Nov-2010) — Parallax Forums

Yet Another LCD Driver Object (V1.3 14-Nov-2010)

Ding-BattyDing-Batty Posts: 302
edited 2010-11-16 13:57 in Propeller 1
Current version: LCD_Ding_Batty version 1.3 -- 14-Nov-2010

I have just uploaded to ObEx version 1.0 of a new parallel LCD driver object, that I think has a few interesting attributes: http://obex.parallax.com/objects/667/

It is a layered driver: the lower layer handles display initialization and communication (4-bit or 8-bit, direct Propeller I/O or indirect through an I/O expander, etc.), while the upper layer handles all the quirks of the display configuration (number of lines/columns, mapping character positions to display memory addresses, etc.)

As of version 1.3, there are implementations for both the 4-bit and 8-bit interfaces to most LCD display controllers, directly from Propeller I/O pins, and there are drivers for 16x1, 16x2 (called "Nx2"), and 20x4 displays. The 16x1 display tested is the display being sold inexpensively by pi'd in this thread: http://forums.parallax.com/showthread.php?t=124913, but I have more displays to play with :)

Except for one quirk of the first display I have been working with, there are no timed-delays (waitcnt calls) after initialization. It is full function, and the demo program includes a user-defined set of characters that show an animated spinning hourglass, which is fun to watch.

It is completely in Spin, and extensively commented.

Update: 24-Sep-2010: Version 1.1 uploaded to ObEx

Changes:
- Now has 20x4 LCD driver, with test program
- Now has 20x4 VFD driver (different memory use than the HD44780 LCD controller), with test program.

Update: 24-Oct-2010: Version 1.2
uploaded to ObEx

Changes:
- Now has Nx2 LCD driver for most two-line displays (16x2 tested), with test/demo program
- Small modifications to the base driver for some timing issues
- Small modification to the 16x1 driver, to make it easier to modify for other widths (such as 24x1).

Update: 14-Nov-2010: Version 1.3 uploaded to ObEx

Changes:
- Added Base driver for 8-bit, direct I/O to the display board.

For Your Consideration...

Ding-Batty

Comments

  • Ding-BattyDing-Batty Posts: 302
    edited 2010-09-24 13:35
    Update: 24-Sep-2010: Version 1.1 uploaded to ObEx

    Changes:
    - Now has 20x4 LCD driver, with test program
    - Now has 20x4 VFD driver (different memory use than the HD44780 LCD controller), with test program.

    Links are in the first message of the thread.
  • Ding-BattyDing-Batty Posts: 302
    edited 2010-10-24 15:45
    Update: 24-Oct-2010: Version 1.2 uploaded to ObEx

    Changes:
    - Now has Nx2 LCD driver for most two-line displays (16x2 tested), with test/demo program
    - Small modifications to the base driver for some timing issues
    - Small modification to the 16x1 driver, to make it easier to modify for other widths (such as 24x1).

    Links are in the first message of the thread.

    The timing issues involved problems with a display shift command right after a display clear: the shift was not always done. It seems to require an additional delay after the display reports that it is no longer busy with the clear operation.
  • Ding-BattyDing-Batty Posts: 302
    edited 2010-11-14 22:06
    Update: 14-Nov-2010: Version 1.3 uploaded to ObEx

    Changes:
    - Added Base driver for 8-bit, direct I/O to the display board.

    Links are in the first message of the thread.
  • MacTuxLinMacTuxLin Posts: 821
    edited 2010-11-14 22:43
    Hey, I'll replace the current driver I'm using with yours & test. I like the commented notes.

    Thanks.
  • MacTuxLinMacTuxLin Posts: 821
    edited 2010-11-14 23:11
    Hi Ding_Batty,

    I've tested & had a little problem. Please advice me if I've made a mistake. The LCD I'm using is TC1602A (http://www.tinsharp.com/en/newproducts.html). It worked with this driver from (http://obex.parallax.com/objects/484/)

    The changes I did in your driver are:

    [code/]
    RS = 16 ' 1
    RW = 17 ' 2
    E = 18 ' 3

    DBLow = 15 ' 0
    DBHigh = 8
    [/code]


    Thanks in advance.
    791 x 365 - 51K
  • Ding-BattyDing-Batty Posts: 302
    edited 2010-11-15 06:21
    MacTuxLin wrote: »
    Hi Ding_Batty,

    I've tested & had a little problem. Please advice me if I've made a mistake. The LCD I'm using is TC1602A (http://www.tinsharp.com/en/newproducts.html). It worked with this driver from (http://obex.parallax.com/objects/484/)

    The changes I did in your driver are:

    [code/]
    RS = 16 ' 1
    RW = 17 ' 2
    E = 18 ' 3

    DBLow = 15 ' 0
    DBHigh = 8
    [/code]


    Thanks in advance.

    You also need to change which low-level driver you use -- this is done in the LCD_Nx2.spin driver, in the OBJ section. From the look of your display, and from the changes you made, I suspect that you wanted the 8-bit interface to be used (pins P8..P15) but the OBJ section in LCD_Nx2.spin is set for the _4bit_ version of the low-level driver.

    I suppose I could change the low-level driver to support both 8 and 4 bit interfaces, but that would make it larger (but easier to use... Hmmm....)
  • MacTuxLinMacTuxLin Posts: 821
    edited 2010-11-15 06:51
    Ding-Batty wrote: »
    You also need to change which low-level driver you use -- this is done in the LCD_Nx2.spin driver, in the OBJ section.

    Oh ... overlooked that. I'll change. Thanks.
  • John KauffmanJohn Kauffman Posts: 653
    edited 2010-11-15 16:21
    Any chance of adding a PUB that handles the button press of the Parallax LCD App Mod part 29121?
    http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/SortField/0/Level/a/ProductID/53/Default.aspx
  • HarleyHarley Posts: 997
    edited 2010-11-15 16:49
    Some years ago I purchased several of those 2x8 LCD modules. Very handy for some projects.

    One needs be very frugal with naming any variables, with only 16 characters positions. I used lower case 'a', 'd', 's' and some other characters for address, data, status, etc. to contrast with the upper case use of 'hex' characters. Worked well and quite legible. Of course, had a pot for contrast and several pb switches in the design. This Parallax LCD App Mod would have been convenient then.
  • Ding-BattyDing-Batty Posts: 302
    edited 2010-11-16 13:57
    Any chance of adding a PUB that handles the button press of the Parallax LCD App Mod part 29121?
    http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/SortField/0/Level/a/ProductID/53/Default.aspx

    I am not at my hardware right now, but I took a look at the schematic for that board, and it looks pretty easy.

    That display is wired using 4-bit access, and the buttons are wired to the same 4 bits used for the display, as pull-ups (when a button is pressed, a resistor network pulls the data line up to about 4.5V), so when read, a '1' means the button is pressed.

    So, the basic operations needed:
    - set those four pins to input (normally the lowest-level driver has them set to output);
    - read those four lines
    - reset those four pins to output.
    - any of them that are '1's stand for pressed buttons.

    Note that this simply reads the lines, and does no debouncing of the button signals. That is another issue completely.
Sign In or Register to comment.