HD44780 module error

Posted on
  • I thought I would start playing with some modules today. The first one I tried was the HD44780 using the I2c example. When I try to run it I get this error.

    This is the code...

    I2C1.setup({scl:B6, sda:B7}); 
    var lcd =require("HD44780").connectI2C(I2C1); 
    lcd.print("Hello World!");
    

    This is the error returned.

    Uncaught Error: Field or method "print" does not already exist, and can't create it on undefined
     at line 2 col 7
    4,e,e])}
           ^
    in function "a" called from line 1 col 8
    {a(51,1);a(50,1);a(40,1);a(12,1);a(6,1);­a(1,1);return{write:...
            ^
    in function "f" called from line 2 col 9
    4,e,e])})}
             ^
    in function "connectI2C" called from line 1 col 45
    var lcd = require("HD44780").connectI2C(I2C1);
                                                 ^
     at line 1 col 4
    lcd.print("Hello World!");
        ^
    

    Any suggestions?

  • Are you using an up to date firmware?

    Looks like there should really have been an error about I2C timeouts before the one about print - I was pretty sure that's something that got fixed recently.

    However I reckon the issue is that the display isn't wired up right. Maybe SDA/SCL are crossed over, or maybe they don't have pullup resistors on them? I don't think those displays have them built in.

  • Do you get any errors if you leave off the lcd.print() command?

    If so can you post that?

    Also, do console.log(lcd) and see if there's anything there. I suspect the connectI2C() is encountering an error, resulting in there being no lcd object - so there's no print method.

  • Turns out that my board uses a different IO expander chip. I then used parallel interface and it worked fine. Sorry for the mix up.

    I am curious how you change the I2c address without editing the module as it seems to be hard coded in?

  • Interesting - do you have a link to the module? This is the first time this has come up.

    You'd have to change the module I'm afraid. To be honest a different IO expander IC might well behave in a different way (or be wired differently), so changing the address might not be enough.

    If you want to play around with getting it working, try adding exports={}; at the top of the RHS of the Web IDE, copy and paste in the existing module and do var lcd = exports.connectI2C(I2C1); at the bottom to test it.

    You could then play around with a different address/different commands to see if it works. We could then put the changes back in (either allowing the address to be changed, or it more was needed, having a separate function for your new driver IC).

  • Its the LCD backpack from adafruit.

    I have a module in python that I wrote for it. Perhaps I can port it over.

  • Eep - yes, we should definitely support the Adafruit version. Actually it looks like this came up a few weeks ago, with *yet another IO chip in a module made by Adafruit!

    http://forum.espruino.com/conversations/­272048/

    Adafruit has some Arduino code up for this one as well, at https://github.com/adafruit/LiquidCrysta­l

    Looks like it'll have to be a new function, as the I2C commands are definitely different.

    A connectMCP23008 function should be pretty easy though. i2c.writeTo(0x20,9,data) should handle the write once the IO direction is set.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HD44780 module error

Posted by Avatar for cwilt @cwilt

Actions