Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: 84 by 48 LCD support (aka Nokia 5110)

  1. #1
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,938

    84 by 48 LCD support (aka Nokia 5110)

    Hi All

    For anybody needing a LCD matched to the Teensy size the Nokia 5110/3310 as sold by Adafruit at time of posting worked with Teensy 3.0 using the provided libraries out of the box.

    Same LCD is also available from sparkfun and other assorteds for <$10

    Some general notes for learners like myself:
    Guidance at the learning system is a good place to start. If using a teensy 3 you are already working at 3V levels so don't require the level converter so wiring LCD2-Teensy3 LCD3-Teensy4...LCD6-Teensy7 will match the example program but can be changed around your pin needs.

    Two libraries are needed and the links in the guide are broken at this time of writing, but the product page or download guide page send you to LCD library and the associated graphics library. Be aware that older versions of the graphics library read bitmaps differently so examples or libraries from before mid 2012 may give corrupt results.

    Unlike character LCDs the contrast is software controlled (example sets it to 50), if display is blank try increasing it, too dark decrease it. 'Perfect' band is quite narrow and differs from display to display, but if you can at least get it too dark you know your sending commands to the display successfully.

    Power demands are low (13mA including backlight) so it is feasible to just line up the pins in a bread board against the Teensy 3 and set backlight, power and ground to relevant levels and prototype away.

    Happy programing

    David

  2. #2
    Member
    Join Date
    Jun 2013
    Location
    Southern Colorado
    Posts
    66
    All good information David, thanks.
    These displays are very rugged too. I hooked one up to a T3 with a simple prog that incremented some numbers every half second and some text to simulate
    an e-bike display. I hooked it up to a small lipo and left it outside for 5 hours with the display directly facing the sun and the temp hovering at 100 degrees F.
    It worked great and the display only darkened a teensy bit (pun intended). The change was barely perceptible and when it cooled a bit it was exactly like it was when I set it out. I never dreamed that a 32 bit power house like the T3 would be so easy to work with, but thanks to Paul it's a reality.

    Best Regards to All

  3. #3
    Junior Member
    Join Date
    Apr 2020
    Posts
    8
    I was using these 5110 LCD displays with many Arduinos, even with DUE (84MHz?). Was working without issues. Now jumped to Teensy 4.1 and at base frequency the display does not work. The display works only if i put 4.1 frequency to 24MHz. Are there any libraries for 4.1 that support 5110 LCD while using higher frequencies on 4.1? Or maybe it is a bad idea to use such old-school thing on fast 4.1?

    Thank you!

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,916
    ...would be easier to answer if we knew which library you use maybe we can look at it...

  5. #5
    Junior Member
    Join Date
    Apr 2020
    Posts
    8
    Right, sorry for that.
    It's LCD5110_Basic library from Rinky Dink electronics.
    http://www.rinkydinkelectronics.com/library.php?id=45

    Simple to use, stable. Works on AVR and ARM, but at a slow frequency. I have looked into source code, there are no delays, so the library is fast, but when running at 600MHz it is too fast for a display controller to digest

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,916
    Code:
    void LCD5110::_LCD_Write(unsigned char data, unsigned char mode)
    {   
        cbi(P_CS, B_CS);
    
        if (mode==LCD_COMMAND)
            cbi(P_DC, B_DC);
        else
            sbi(P_DC, B_DC);
    
        for (unsigned char c=0; c<8; c++)
        {
            if (data & 0x80)
                sbi(P_MOSI, B_MOSI);
            else
                cbi(P_MOSI, B_MOSI);
            data = data<<1;
            pulseClock;
        }
    
        sbi(P_CS, B_CS);
    }
    Yes, that looks like some delayMicroseconds() would be helpful.

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,916
    ..any you may alos want to look at pulseClock with just uses a "nop"
    Code:
    #define pulseClock cbi(P_SCK, B_SCK); asm ("nop"); sbi(P_SCK, B_SCK)
    That's way too fast, I think.

    Maybe just edit the cbi and sbi macros and add a delayMicroseconds(10) there.. if that works you can try a shorter delay, or even delayNanoseconds()

    Code:
    #define cbi(reg, bitmask) {*reg &= ~bitmask;delayMicroseconds(10);}
    #define sbi(reg, bitmask) {*reg |= bitmask;delayMicroseconds(10);}

  8. #8
    Junior Member
    Join Date
    Apr 2020
    Posts
    8
    Thank you very much! I will give it a try and report back.
    I understand, that all these delays will slow down the mcu. I am thinking about using ILI9341 display instead. There are 3 SPI buses on the T4.1, so there should be no useless delays in cpu load.

    Thank you very much for help!

  9. #9
    Junior Member
    Join Date
    Apr 2020
    Posts
    8
    Got it work with 10microsecond delay @ 150 MHz Thank you! I see now, that i have choosen the wrong approach. Should really use higher speed displays.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •