Hd44780

Anyone managed to get a HD44780 running on a imp directly ?
I am aware it will take up the majority of pins avaliable on the imp002 and every pin the imp001 has, but it would make a cheap wifi LCD for basic information, the imp002 would still have a few pins spare for buttons and a sensor or two (or I2C for that matter).

4 data lines
1 enable line
1 register select line
(1 r/w line that can be omitted for a short sleep instead)

Yep, I did that back in 2011, but that was pre-squirrel. So, yes it’s possible (make sure you have a 3.3v display, though) but I can’t show you code…

Starting to get back to this, I made some not very pretty code and hooked up the wires … and nothing happens, so its work in progress :slight_smile:

I hooked up A-D4,B-D5,C-D6,D-D7,en-p1,rs-P2 (on a imp002).
Not sure if the 3v3 signals to a 5v display is too low to register as high though.

Current attempt at init the display in 4bit mode.
`
en <- hardware.pin1
Drs <- hardware.pin2
D4 <- hardware.pinA
D5 <- hardware.pinB
D6 <- hardware.pinC
D7 <- hardware.pinD

function sendCmdByte(data)
{
server.log("Sending "+data);
server.log(data&0x80);
server.log(data&0x40);
server.log(data&0x20);
server.log(data&0x10);
server.log(data&0x8);
server.log(data&0x4);
server.log(data&0x2);
server.log(data&0x1);

Drs.write(1);
if (data & 0x80)
    D7.write(1);
else
    D7.write(0);

if (data & 0x40)
    D6.write(1);
else
    D6.write(0);
    
if (data & 0x20)
    D5.write(1);
else
    D5.write(0);
    
if (data & 0x10)
    D4.write(1);
else
    D4.write(0);       
    
en.write(1);
imp.sleep(0.1);
en.write(0);
imp.sleep(0.1);

if (data & 0x08)
    D7.write(1);
else
    D7.write(0);

if (data & 0x04)
    D6.write(1);
else
    D6.write(0);
    
if (data & 0x02)
    D5.write(1);
else
    D5.write(0);
    
if (data & 0x01)
    D4.write(1);
else
    D4.write(0);       
    
en.write(1);
imp.sleep(0.1);
en.write(0);
imp.sleep(0.1);    

}

server.log(“Sleeping”);
imp.sleep(2);
server.log(“INIT”);

sendCmdByte(0x33);
sendCmdByte(0x32);

sendCmdByte(0x28);
sendCmdByte(0x0C);
sendCmdByte(0x06);

sendCmdByte(0x01);
`

The pins you are using don’t appear to be configured. You need to use pin.configure() for each of them.

hmm, good catch, I added en/drs/D4…D7.configure(DIGITAL_OUT), but same result.

I will debug it some more over the weekend.

Hi Mora,

Did you manage to get the LCD work?
I am trying to configure the LCD with the 4-bit interface, but my Init function doesn’t seem to work. My LCD is only displaying the first line with all pixels ON.
I would appreciate if I could benefit from your previous work…

J-P

Oh, well, this is working now. I was tinkering with a S6A0069 controller instead of a HD44780. The instruction set seems to be the same but when used in 4-bit mode, the S6A0069 is bullshit…

By the way, I think the “Drs.write(1);” in your code above is not for a command, but for a data transfer…