Menu

0.96" OLED SPI Display with SSD1306

kent_twt4
2017-02-14
2017-02-18
  • Anobium

    Anobium - 2017-02-14

    Thanks Kent.

    The is some code that is commented out - in the .h. It would be really good if you could remove.

    May I pick these files up and move into the next release?

     
  • kent_twt4

    kent_twt4 - 2017-02-14

    Alright, cleaned up the commented code I think, let me know. Thanks for looking.

    Yes, good to go on using the files.

    Using "#startup" for the INIT_GLCD_SSD1306 is a little tricky to negotiate. There is the possiblity of running the code before the data direction pins are set. The new library has to handle that by setting the data direction pins inside the INIT_GLCD_SSD1306.

     
  • kent_twt4

    kent_twt4 - 2017-02-18

    Sorry to report a hiccup with code. During development having the programmer hooked up fulltime masked an intitial startup problem on power up. The RES pin is now pulsed low briefly per datasheet, instead of tied to Vcc. No gibberish now.

     

    Last edit: kent_twt4 2017-02-18
  • Anobium

    Anobium - 2017-02-18

    Thanks.

    A few question:

    Why INITGLCD_SSD1306? Can you try without this? What happens? If the #startup is not working then we should fix.

    Do yoy have a few moments to test a fully set of GLCD capabilities? add this to the demo.

    ; ----- Define variables
    
      Dim BYTENUMBER, CCOUNT as Byte
    
      CCount = 0
      dim longNumber as long
      longNumber = 123456 ' max value = 4294967290
      dim wordNumber as Word
      dim outstring as string
      wordNumber = 0
      byteNumber = 0
    
    ; ----- Main program
    
      GLCDCLS
      GLCDPrint 0, 0, "Great Cow Basic"
      GLCDPrint (0, 16, "Anobium 2015")
    
    
      wait 3 s
      GLCDCLS
    
      ' Prepare the static components of the screen
      GLCDPrint ( 0,   0, "PrintStr")                                ; Print some text
      GLCDPrint ( 64,  0, "@")                                    ; Print some more text
      GLCDPrint ( 72,  0, ChipMhz)                                   ; Print chip speed
      GLCDPrint ( 86, 0, "Mhz")                                     ; Print some text
      GLCDDrawString( 0,8,"DrawStr")                                 ; Draw some text
      box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1                            ; Draw a box
      box GLCD_WIDTH-5, GLCD_HEIGHT-5,GLCD_WIDTH-1, GLCD_HEIGHT-1    ; Draw a box
      Circle( 44,41,15)                                              ; Draw a circle
      line 64,31,0,31                                                ; Draw a line
    
      DO forever
         for CCount = 31 to 127
              GLCDPrint ( 64 ,  36,  hex(longNumber_E ) )                 ; Print a HEX string
              GLCDPrint ( 76 ,  36,  hex(longNumber_U ) )                 ; Print a HEX string
              GLCDPrint ( 88 ,  36,  hex(longNumber_H ) )                 ; Print a HEX string
              GLCDPrint ( 100 ,  36, hex(longNumber   ) )                 ; Print a HEX string
              GLCDPrint ( 112 ,  36, "h" )                                ; Print a HEX string
    
    
              GLCDPrint ( 64 ,  44, pad(str(wordNumber), 5 ) )           ; Print a padded string
              GLCDPrint ( 64 ,  52, pad(str(byteNumber), 3 ) )           ; Print a padded string
    
    
              box (46,9,56,19)                                           ; Draw a Box
              GLCDDrawChar(48, 9, CCount )                               ; Draw a character
              outString = str( CCount )                                  ; Prepare a string
              GLCDDrawString(64, 9, pad(outString,3) )                   ; Draw a string
    
              filledbox 3,43,11,51, wordNumber                           ; Draw a filled box
    
              FilledCircle( 44,41,9, longNumber xor 1)                   ; Draw a filled box
              line 0,63,64,31                                            ; Draw a line
    
                                                                         ; Do some simple maths
              longNumber = longNumber + 7 : wordNumber = wordNumber + 3 : byteNumber++
          NEXT
      LOOP
      end
    

    And, could you add the standard header? This will then enable it to be loaded into GCGB without messing up. So, add and edit the following:

    '''A demonstration program for GCGB and GCB.
    '''--------------------------------------------------------------------------------------------------------------------------------
    '''This program is a simple GLCD demonstration of the '''A demonstration program for GCGB and GCB.
    '''--------------------------------------------------------------------------------------------------------------------------------
    '''This program is a simple GLCD demonstration of the SSD1306 GLCD capabilities.
    '''This program draws lines, boxes, circles and prints strings and numbers.
    '''The SSD1306 controller a small graphical OLED, suitable for a lot of various projects.
    '''The display is 38*35 mm, with an active display surface of 0.96inches , and a 128*64 pixel resolution.
    '''The display is easy to interface, using an I2C type of communication.
    '''The GLCD is connected to the microprocessor as shown in the hardware section of this code.
    '''@author  Kent
    '''@licence GPL
    '''@version ??
    '''@date    ??
    '''********************************************************************************
    

    I will update the .h file with licensing etc but I cannot test a demo file with this specific SPI configuration. Hence, no point in me making these changes which would be untested.

    If you can make these changes then send or upload a new version that would be great!

     
  • kent_twt4

    kent_twt4 - 2017-02-18

    Good catch, no reason whatsoever for the INITGLCD_SSD1306 as glcd.h handles that. Guess I'm so used to handling initialization calls in program, OR what was once commented, became uncommented?

    Another stab at the GLCD demonstration program, I just added some more of the commands to previous example. Everything is printing properly.

     

    Last edit: kent_twt4 2017-02-18
  • Anobium

    Anobium - 2017-02-18

    You posted the asm... lol Not the source file.

     
  • kent_twt4

    kent_twt4 - 2017-02-18

    Fixed? Oh my, the grey matter isn't performing too well today, :-)

     
  • Anobium

    Anobium - 2017-02-19

    @Kent. The .h and the demo is now included in the next build. I have updated the Gold build with both files.

     
  • kent_twt4

    kent_twt4 - 2017-02-19

    Thanks much, onward and upward we go.

     

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.