Text LCD -- Two Wire


Need to free up some port pins? Then here's a solution: a two-wire LCD display. The secret lies in the 74HC595 which is a synchronous shift register. In a nutshell, we'll roll in the LCD commands a bit at a time and let the shift register assemble them into a parallel pattern. One thing that sets this one apart from other approaches you might have seen on the Web is how I create the Enable signal via differentiation (C1 and R4). I was so enamored of this, that I wrote up the article "An Easy Two-Wire LCD" for Nuts & Volts Magazine, February 2014, pp. 30-35, to explain it.


I'm using the same hardware here, but have ported the software over from my original Great Cow Basic code of the article to PIC Micro Pascal. But the operation is the same.


I fabricated a PCB piggyback for the circuit, which lies below the LCD in the photo above. Here it is by itself:


As usual, you'll want to choose R1 to limit the current to the LCD backlight appropriately.

The program puts the unit through its paces showing all manner of messages, scrolling, cursor types and the full character set. And the code is actually fairly compact.

Click to get the source code.
Click to get the schematic PDF.

Next Project: Text LCD -- RGB Backlight

2 comments:

  1. Hi Thomas,
    this exercise works fine;
    Using PMP V 2.1.4.111 and as discussed in Philippe's forum I replaced the OSCON statement
    from
    OSCCON :=[IRCF = 0b111];
    to
    OSCCON := 0b01110000;
    This reduces the LCD lines from the PIC from 6 to 2, that's nice.
    Regards
    Bernd.

    ReplyDelete
    Replies
    1. Thanks for the comment, and glad it worked for you. I've always like this approach even if serial communication is a bit slower. Still, for displays that don't change radically (animation, etc.) it's quite usable.

      Delete