Menu

ST7567S - GLCD driver

Anobium
2023-06-05
2023-06-22
  • Anobium

    Anobium - 2023-06-05

    This thread explains the support for the ST7567S GLCD driver.


    Status: Proven to work

    i have received a ST7567S from China. I have tried to get it to work and the GLCD would not respond to I2C commands. I got a full refund.

     

    Last edit: Anobium 2023-06-18
  • Anobium

    Anobium - 2023-06-18

    New ST7567 GLCD library added

    This is a new GLCD library. The ST7567 is medium sized LCD (therefore bright), 2inches wide and is fast to update.

    The ST7567 is a single-chip CMOS LCD driver with controller for organic / polymer light emitting diode dot-matrix graphic display system. It consists of 128 segments and 64 commons. This IC is designed for Common Cathode type LCD panel.

    ST7567 is a single-chip dot matrix LCD driver which incorporates LCD controller and common/segment drivers. A ST7567 can be connected directly to a microprocessor with I2C or 4-line serial interface (SPI-4).

    Display data sent from microprocessor is stored in the internal Display Data RAM (DDRAM) of 65x132 bits. The display data bits which are stored in DDRAM are directly related to the pixels of LCD panel. The ST7567 contains 132 segment-outputs, 64 common-outputs and 1 icon-common-output, however the address pixels are 128 * 64.

    The ST7567 has built-in oscillation circuit and low power consumption power circuit, ST7567 generates LCD driving signal without external clock or power, so that it is possible to make a display system with the fewest components and minimal power consumption.

    The ST7567 embeds with contrast control, display RAM and it is suitable for many compact portable applications, such as mobile phone sub-display, MP3 player and calculator, etc.

    The Great Cow BASIC constants shown below control the configuration of the ST7567 controller. Great Cow BASIC supports SPI and I2C software connectivity - this is shown in the tables below.

    The ST7567 library supports 128 * 64 pixels.

    The ST7567 is a monochrome device.

    The ST7567 can operate in three modes. Full GLCD mode, Low Memory GLCD mode or Text/JPG mode the full GLCD mode requires a minimum of 1k bytes or 512 bytes for the 128x64 respectively in Full GLCD mode. For microcontrollers with limited memory the third mode of operation - Text mode. These can be selected by setting the correct constant.

    The library supports software/hardware I2C and software/hardware SPI. The ST5767 does not comply with the I2C, and, therefore some of the latest PICs Hardware I2C module will fail to communicate with the ST7567 - you will get a message telling you to use software I2C.

    'An I2C configuration
    #include <glcd.h>
    
    ; ----- Define GLCD Hardware settings
    #define GLCD_TYPE GLCD_TYPE_ST7567
    #define GLCD_I2C_Address 0x7E
    '#define GLCD_TYPE_ST7567_LOWMEMORY_GLCD_MODE       'select Low Memory mode of operation
    '#define GLCD_TYPE_ST7567_CHARACTER_MODE_ONLY       'select Text mode of operation
    
    
    ; ----- Define software IC2 settings
    #DEFINE I2C_MODE MASTER
    #DEFINE I2C_DATA PORTB.4
    #DEFINE I2C_CLOCK PORTB.6
    #DEFINE I2C_DISABLE_INTERRUPTS ON
    

    or,

        'An SPI configuration'
        #include <glcd.h>
    
        ; ----- Define GLCD Hardware settings
        #define GLCD_TYPE GLCD_TYPE_ST7567
    
        ; ----- Define Hardware settings
        #define S4Wire_DATA
    
        #define MOSI_ST7567 PortB.1
        #define SCK_ST7567  PortB.2
        #define DC_ST7567   PortB.3
        #define CS_ST7567   PortB.4
        #define RES_ST7567  PortB.5
    

    I have posted a demo to GitHub , see here . This demo will be included in the demonstration download/installer.


    Enjoy

     

    Last edit: Anobium 2023-06-19
  • Anobium

    Anobium - 2023-06-19

    I have posted more demos to GitHub. I wanted to ensure the GLCD worked across a range of microcontrollers.

    ST7567 works well at 3v3 volts across all the PICs I tested using software I2C.
    ST7567 works well at 3v3 volts across all the PICs hardware I2C if the microcontroller uses the MSSP/IC2 module. PICs hardware I2C modules ( q43/q71 etc) fail because this module cannot handle the errant ST7576 I2C protocol... these microcontrollers keep sending the I2C address and nothing else.
    ST7567 is untested with an UNO. As this will require a voltage leveller. The UNO will work it just needs the voltage leveller.

     
  • stan cartwright

    stan cartwright - 2023-06-19

    Good work. Thanks.

     
    • Anobium

      Anobium - 2023-06-20

      Thank you!

       
  • Anobium

    Anobium - 2023-06-20

    A video showing setup and usage.

    This video has two uses. First six minutes show setup and usage. Everything after 6:04 is for Microchip support to resolve the hardware IC2 issue.

     
    • Jerry Messina

      Jerry Messina - 2023-06-21

      Evan,

      Looking at the datasheets, the ST7567 doesn't claim to support I2C, only SPI. The ST7567S does have I2C support. It's not clear which controller you're using in the video.

       
      • Anobium

        Anobium - 2023-06-21

        From my notes here. What version etc of the datasheet are you reviewing? URL ?

        GLCD MPU Interfaces Datasheet Ref Support
        ST7576 3&4 Pin SPI;I2C;Parallel 8080&6080 Ver1;Page 14; GCB 3&4 Pin SPI & I2C
        ST7567 4 Pin SPI;Parallel 8080&6080 Ver1.4b;Page 12 GCB 3&4 Pin SPI & I2C
        ST7565S Parallel 8080&6080 Ver 0.6b;Page 23 GCB not supported

        Sitronix did a great job of copying the Sytech SSD1306 with these GLCD MPUs. The init is different but the basic functionality is the same.


        I was using I2C (hardware and software). Dan has tested with the 4 wire SPI.

         
        • Jerry Messina

          Jerry Messina - 2023-06-21

          In the datasheet you posted for the ST7567 I only see it mention 4-wire SPI, not I2C.
          There's a datasheet for an ST7567S that shows both SPI (3 & 4 wire) and I2C.

          That said, it would be interesting to know if the I2C peripheral can be set to ignore a NACK like the MSSP peripheral does. Seems like that new peripheral is more bother than it's worth a lot of times.

           
          • Anobium

            Anobium - 2023-06-22

            Revised analysis, adding the ST7567S and correcting the ST7567 data.

            Index GLCD MPU Interfaces Datasheet Ref Support
            1 ST7565 Parallel 8080&6080 Ver 1.0a;Page 12 GCB not supported .. yet
            2 ST7565S Parallel 8080&6080 Ver 0.6b;Page 23 GCB not supported .. yet
            3 ST7567 4 Pin SPI;Parallel 8080&6080 Ver1.4b;Page 12 GCB 3&4 Pin SPI
            4 ST7567S 3&4 Pin SPI;I2C;Parallel 8080&6080 Ver1.4;Page 17; GCB 3&4 Pin SPI & I2C
            5 ST7576 3&4 Pin SPI;I2C;Parallel 8080&6080 Ver1;Page 18; GCB 3&4 Pin SPI & I2C

            Notes
            The parallel interface can be added. Someone would need to add. :-)
            AliExpress lists GLCD that are ST7567S - my advice .. look for I2C (in the listing) before buying the product


            Re the hardware I2C module issue. I am working with Microchip to resolve. No progress yet.

             

            Last edit: Anobium 2023-06-22
  • Dan Goss

    Dan Goss - 2023-06-20

    Hello everyone. Thanks Evan for this Library. I have several similar displays with the ST7565 driver. The particular ones I have are reflective with no backlight so low power. I had written my own library for this display but it appears to be nearly identical to the ST7567. The only problem I had is that the contrast was too dark using the ST7567 library on my ST7565 even when the contrast was set at the lowest setting in software. Then when I compared my library with yours, the one difference was that the ST7565 was using the 1/7 duty cycle (led bias) instead of 1/9 lcd duty cycle command. Once I changed that it works great. I included a picture using the ST7565 display on the ST7567 library with just the minor change of software. It is running on an lgt8 with spi4. I will use your library since it is an official GCB library and I won't have to mess with my own that included a modified <glcd.h> as well to include this display. Perhaps it's just the duty cycle that needs to be changed to make an official ST7565 display library. These ST7565 displays are also very inexpensive on AliExpress. One question I did have is regarding the ST7789 display. You had written the library a few years ago for me for a 240x240 display. I also have a much larger 240x320 ST7789 display. I tried using this display with the unmodified 240x240 library along with the invaders demo under the glcd games folder. Of course I had to make some modifications to the game since it expects to write to a different display but everything seemed to work fine. I imagine though if I tried to fill the screen the text it wouldn't since it is expecting 240x240. So maybe only a few lines of code would need to be changed for complete library for the 240x320 ST7789? I'd be happy to test it on my ST7789 240x320. Thanks again everyone for all your hard work on GCB. I absolutely love it and have made several cool gadgets with it.</glcd.h>

     
  • Anobium

    Anobium - 2023-06-20

    @Dan - good to hear it works.

    The ST755 is very similar to the ST7567,


    What change did you make to the new library ? The exact change please.

    It is easy to add ST755 support if it works with your change.


    I have a later ST7567 library here - it supports different BIASs,

    Do you want to try this new library ?


    Re: ST7789

    I can add #if GLCD_TYPE = GLCD_TYPE_ST7789_320_240, if you will test.

     
  • Dan Goss

    Dan Goss - 2023-06-20

    I changed this line " Write_Command_ST7567(0xa3) // LCD bias 1/7". For the ST7567 it is 0xa2 1/9 bias. I changed to 0xa3 1/7 bias. Both are listed in the #defines. I would be happy to try the new library. Also, thanks for ST7789 320x240. I will be happy to test when available. Thanks!

     
    • Anobium

      Anobium - 2023-06-20

      Replace these files.


      To change/use

          #include <glcd.h>
          #DEFINE GLCD_TYPE GLCD_TYPE_ST7567
          #DEFINE ST7567_BIAS ST7567_SET_BIAS_9    ' ST7567_SET_BIAS_7 or ST7567_SET_BIAS_9
          #DEFINE GLCDDIRECTION INVERTED
      

      The constant ST7567_BIAS must be either ST7567_SET_BIAS_7 or ST7567_SET_BIAS_9 - these equate to the two settings.

      Left me know the results.

       
  • Dan Goss

    Dan Goss - 2023-06-20

    I replaced both files and included the defines. Whether I set it to Set_Bias_9 or 7 didn't make a difference. The display worked fine on both. I expected on Bias_9 it to be much darker.

    #include <glcd.h>
        #DEFINE GLCD_TYPE GLCD_TYPE_ST7567
        #DEFINE ST7567_BIAS ST7567_SET_BIAS_9  ' ST7567_SET_BIAS_7 or ST7567_SET_BIAS_9
        #DEFINE GLCDDIRECTION INVERTED
    
     

    Last edit: Anobium 2023-06-21
  • Anobium

    Anobium - 2023-06-20

    Can you post your adapted .H file ? Hopefully you still have it.

    I think you changed line 274 in the version 1.00 of the published .h file.


    Does the GLCDDirection change? It this does not then the .h files are not in the correct folder.

     
  • Dan Goss

    Dan Goss - 2023-06-20

    Yes, I changed line 274. I can check later if the Directionn changes.

     
  • Anobium

    Anobium - 2023-06-21

    You .h looks good.

    Can you check the Direction ?

    Can you see the LCD OK? try changing the Duty in the .h

     
  • Dan Goss

    Dan Goss - 2023-06-21

    Hi Evan. The Set_Bias is working correctly now. Apparently, I had grabbed the files from the Windows 'recents' instead of 'downloads'. When I #DEFINE ST7567_BIAS ST7567_SET_BIAS_9 it is dark as expected. With it is at 7 it is just right for the ST7565, That's nice just changing one define to make it work for both display types. However, on my display, whether I comment out #DEFINE GLCDDIRECTION INVERTED or not does not make a difference on my display. I will take a look at the ST7789 now.

     
  • Anobium

    Anobium - 2023-06-21

    @Dan.

    Odd regarding #DEFINE GLCDDIRECTION INVERTED as this is maths operation not a GLCD register change. So, check the ASM in the PSET assembly - you should see some maths the changes GLCDY or GLCDX depending on the existant of the constant GLCDDIRECTION.


    Hopefully the ST7789 works ok,

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.