Driving the low cost NHD ‐ C0220BiZ I2C LCD

Posted on
  • Hi,

    I would like to interface my Espruino Pico with an NHD-C0220BiZ LCD from Newhaven display. It is quite easy to drive. I used to do it with an Electricimp a few months ago ( https://forums.electricimp.com/discussion/3198/using-the-newhaven-i2c-2x20-char-display-nhd-c0220biz-fsw-fbw-3v3m ) but now I have some problem for the reset waveform generation (optional, but it is a good practice). I would like to drive the reset pin HIGH, LOW for some time, and finally HIGH (´´´´´______/´´´´´´´´´´´). This is really easy to do with some kind of a "delay()" function, but Espruino is not intended to work this way... I though to use 2 setTimeout() in order to control the positive&negative pulses duration, but finally I ask you if someone could give me a cleaner method?

  • http://www.espruino.com/Reference#l__global_digitalPulse

    There's a function to do that builtin :-)
    There are a few cases where not having a delay() is awkward - but in all but a few circumstances, you really don't want to do busy-waiting. If you need to, you can create a delay() function yourself in JS - I did that for the AT24/AT25 eeprom code that needs a few-ms delay periodically.

    That said, the code at that link looks suspiciously similar to the code used for HD44780 (which we have a module for). That's not just an HD44780 clone is it?

  • Hi!

    There's digitalPulse but as the reference says it is better to do setTimout "if you're doing anything over a few milliseconds".

  • Thank you for the link, I did not realize I could do digital waveforms with digitalPulse() !
    Actually this LCD has a ST7036i controller, which is slightly different... That said, I did not use a I2C based HD44780, I don't know if, in this mode, the command set is the same or not...
    I already used a LCD with HD44780 controller and a 4-bit interface, that was "far too easy" to drive ;-)

  • Just to add, the reason there isn't a delay function is because the interpreter isn't multi-threaded, so when you start writing functions that take a long time to execute, things start to lag and potentially data that comes in via Serial/USB/etc gets lost (if buffers get full).

    Generally there are pretty easy ways around it - but if there was a simple delay() command then most people wouldn't bother and their experience of using Espruino would be much worse :)

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

Driving the low cost NHD ‐ C0220BiZ I2C LCD

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey

Actions