You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • First, you have to talke to MPC23017 I2C expander and configure it that through it you will talk to the HD44780 LCD controller. Latter you will then have to configure as well before can actually send commands and data to show something on the display.

    |           I2C            6..10 Bit
    |          serial          parallel                 
    |                          for LCD
    |                          controller
    |                          plus more
    |                          for leds
    |                          and buttons
    |                             |---------------------> LED for back light
    | Espruino <----> MPC23027 <--+----> HD44780 <------> LCD
    |                             |---------------------> Button 0 (select)
    |                             |---------------------> Button 1 (North, up)
    |                             |---------------------> Button 2 (East, right)
    |                             |---------------------> Button 3 (South, down)
    |                             |---------------------> Button 4 (West, left)
    |          2 wires         about 7..11         hundredth(s)      
    |                          wires(see schema)     of wires
    

    There are many roads to get there and you can use all information available to you, such as the data sheets fort the MPC23027 expander, the datasheet/schema of the 'shield', the HD44780 LCD controller, and - last but not least - the driver software/library module form the 'shield provider'.

    The driver softwrae/library module is written for Arduino and its programming language. If you are used to read that kind of code and are familiar with the related modules used and the hardware, it for sure helps... and if not that much, at least the comments in this code can be
    of help. If this confuses you more thean it helps, just leave it alone and use only the schematics and the MPC23027 expander and HD44780 data sheet.

    In separate posts I will go a bit through the

    1. hardware first, which dictates the software, and then through
    2. coding the configuration of the expader for the given hardware. --- Having come that fare, you should already be able to use the buttons and control the LEDs - I expect. Of course it needs some more Espruino code to do that.
    3. coding for button control
    4. coding for LED control --- With the gained experience, it should then be a breeze:
    5. coding the configuration of the HD44780, and finally,
    6. coding some 'useful' output for the display.

    After working through these steps, you may then want to create an Espruino module that you can pull into your application code with a single line, looking like the second in this code:

    I2C1.setup({scl:B6, sda:B7});
    var lcd = require("LCDAF722").connect(I2C1, function() {
    // your application code controlling the display
    });
    

    Please be forgiving to me when I do not get it right on the first cut... I don't have the 'shield' at hand. I run this all as a thought experiment... I can not verify, but you - @scottKing - can do so. I appreciate your help. Please use the forum's message feature to provide me with feedback and I will adjust my posts.


    1 Attachment

    • LCD16x2blueAndWhite.png
About

Avatar for allObjects @allObjects started