Page 1 of 1

pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:04 pm
by gratefulfrog
Hi,

I'm struggling with the interface to a 16x2 blue LCD display that I'd like to drive from pyboard.

This is where I got it:

http://www.taydaelectronics.com/lcd-dis ... light.html

This is the only datasheet I could find:
http://www.taydaelectronics.com/datasheets/A-1748.pdf

Here is some arduino code using the Liquid Crystal lib:
http://onyxibex.com/2013/02/lcd-1602d1/

I am really at a loss as to how to approach this problem, any ideas would be very welcome!

Cheers,
Bob

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:29 pm
by dhylands
I put together a library in python for driving those types of LCDs. You can find it over here:
https://github.com/dhylands/python_lcd

You'll need these 2 files:
https://github.com/dhylands/python_lcd/ ... lcd/lcd.py
https://github.com/dhylands/python_lcd/ ... pio_lcd.py

and this file is a test file which explains how things are wired up. Note that the way you wire it up is rather arbitrary. You'll need 6 GPIO pins from the pyboard to use the LCD in 4-bit mode.

https://github.com/dhylands/python_lcd/ ... cd_test.py

And I was using a 4x20, so you'll want to change num_lines and num_columns to match your LCD.

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:33 pm
by gratefulfrog
Hey thanks!

I just wrote to you via email as well since I saw your youtube!

That is just what I needed!!!

I'm guessing that I can use any pins I have available, right?

Thanks so much for your help!!!
Ciao,
Bob

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:44 pm
by dhylands
Yeah - pretty much any spare pins will work. Just make sure that the pins you actually use match up with what you pass into the GpioLcd constructor.

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:46 pm
by gratefulfrog
Man, you saved my life!

Do you know if that lcd can do reverse video easily or does it have to be hand tweaked?

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 4:55 pm
by dhylands
You mean inverse (change from white on black to black on white)? I don't think that those LCDs support that at all.

Some of the LCDs support custom letters which you can upload and display, but I've never tried to do that (and there is no direct support for that in my code). It looks like there are 4 or 8 programmable characters from a quick glance through the datasheet.

I see that your LCD uses the ST7066 driver chip, and sparkfun has a datasheet available here: https://www.sparkfun.com/datasheets/LCD/st7066.pdf

Re: pyboard driving a HXF1602D1 LCD display

Posted: Sun Sep 06, 2015 5:11 pm
by gratefulfrog
Thanks again!

That datasheet looks interesting!

At last some real info that I can use...

I hadn't seen that.

Cheers!
Bob