pyboard driving a HXF1602D1 LCD display

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
gratefulfrog
Posts: 149
Joined: Sun Mar 01, 2015 12:10 pm

pyboard driving a HXF1602D1 LCD display

Post by gratefulfrog » Sun Sep 06, 2015 4:04 pm

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

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pyboard driving a HXF1602D1 LCD display

Post by dhylands » Sun Sep 06, 2015 4:29 pm

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.

gratefulfrog
Posts: 149
Joined: Sun Mar 01, 2015 12:10 pm

Re: pyboard driving a HXF1602D1 LCD display

Post by gratefulfrog » Sun Sep 06, 2015 4:33 pm

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

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pyboard driving a HXF1602D1 LCD display

Post by dhylands » Sun Sep 06, 2015 4:44 pm

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.

gratefulfrog
Posts: 149
Joined: Sun Mar 01, 2015 12:10 pm

Re: pyboard driving a HXF1602D1 LCD display

Post by gratefulfrog » Sun Sep 06, 2015 4:46 pm

Man, you saved my life!

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

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pyboard driving a HXF1602D1 LCD display

Post by dhylands » Sun Sep 06, 2015 4:55 pm

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

gratefulfrog
Posts: 149
Joined: Sun Mar 01, 2015 12:10 pm

Re: pyboard driving a HXF1602D1 LCD display

Post by gratefulfrog » Sun Sep 06, 2015 5:11 pm

Thanks again!

That datasheet looks interesting!

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

I hadn't seen that.

Cheers!
Bob

Post Reply