SSD1306 INCLUDE for PBP3


+ Reply to Thread
Results 1 to 40 of 102

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    I was afraid that would be the case. I have spent time playing with that version and can't figure out how to display a bitmap image, which is a requirement for this project. That's using DMDBMP command.

    If I copy in the macro from this version and add the SSDBM command, I can display an image, but not correctly. Likely due to the difference in how the height differs from both drivers.
    Shawn

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,440


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    post what you have tried and i will have a look
    Warning I'm not a teacher

  3. #3
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    When I use SSDBM it shows the top half of the image twice, and seems to lock the display as I can't clear or alter what is displayed afterwards.


    Using the DMDBMP format, it displays a black screen, but if I attempt to display something afterwards it goes nuts. I assume I'm not addressing the BMP data location correctly, but don't see an example or instructions on using a bitmap.
    Code:
    DMDBMP 0,0,logo64  'X,Y,LABEL      (HOW DO I SPECIFY SIZE???)
    gosub show
    Here is the code I am running right now with the bmp. Doing it this way seems to get stuck right after the image is displayed, and it looks like the picture below.
    Code:
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  PLLCFG = ON
      CONFIG  PRICLKEN = ON
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRTEN = ON
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 190
      CONFIG  WDTEN = ON
      CONFIG  WDTPS = 32768
      CONFIG  CCP2MX = PORTC1
      CONFIG  PBADEN = OFF
      CONFIG  CCP3MX = PORTB5                                
      CONFIG  T3CMX = PORTC0
      CONFIG  HFOFST = ON
      CONFIG  P2BMX = PORTB5
      CONFIG  MCLRE = EXTMCLR
      CONFIG  STVREN = ON
      CONFIG  LVP = OFF
      CONFIG  XINST = OFF
      CONFIG  DEBUG = OFF
      CONFIG  CP0 = OFF
      CONFIG  CP1 = OFF
      CONFIG  CP2 = OFF
      CONFIG  CP3 = OFF
      CONFIG  CPB = OFF
      CONFIG  CPD = OFF
      CONFIG  WRT0 = OFF
      CONFIG  WRT1 = OFF
      CONFIG  WRT2 = OFF
      CONFIG  WRT3 = OFF
      CONFIG  WRTC = OFF
      CONFIG  WRTB = OFF
      CONFIG  WRTD = OFF
      CONFIG  EBTR0 = OFF
      CONFIG  EBTR1 = OFF
      CONFIG  EBTR2 = OFF
      CONFIG  EBTR3 = OFF
      CONFIG  EBTRB = OFF
    #ENDCONFIG       
    OSCCON=%01110000                ' SET TO 16 MHZ internal oscillator
    OSCTUNE.6=1                     ' 4xPLL
    DEFINE OSC 64
        ;set these  to match display
        ssd1306_addr con $78 
        #DEFINE colours 1   ;1 mono 2 rg or 3 rgb
        width  con 128      
        height con 64      
        h_offset con 0   ;28 for 40x72
        
        include "grx.pbpMOD" 
        include "SSD1306.pbpMOD"
        include "font.bas"
        include "bignum.bas"       
        include "bigchr.bas"
        BUFF     VAR BYTE[10]
        J VAR BYTE
    
        BGCOLOUR=0  
        ANSELB=0
        ANSELC=0
        ANSELA=0
        OSCCON=$70
        
      
        gosub glcd_init
        gosub grf_clr
        gosub show
        SETFONT FONT5x7
                  
    main:
    
    
    'DMDBMP 128,64,logo64  'X,Y,LABEL      (HOW DO I SPECIFY SIZE???)
    'gosub show
    
    'pause 5000
    'gosub grf_clr
    'gosub show
    
        ARRAYWRITE BUFF,["STRING OF TEXT",0]
        DMDSTR 10,5,buff,1             
        gosub show
        
        pause 5000
        gosub grf_clr
        gosub show
        
    SSDBM 31,0,64,64 ,logo64        'This displays the top half of the image ok, and repeats the top half on lower half of screen
                                    'Using this MACRO inside of grx.pbpmod 
                                    'SSDBM?CCCCL   macro Xin ,Yin ,Win,Hin,BMin 
                                    ' IFNDEF  TBLPTRL
                                    '    ERROR BITMAPS ONLY SUPPORTED ON PIC18
                                    ' ENDIF
                                    '     MOVE?CB Xin , _gx
                                    '     MOVE?CB Yin , _gy
                                    '     MOVE?CB Hin/8+Yin-1 , _gy_    
                                    '     MOVE?CB Win+Xin-1 , _gx_
                                    '     MOVE?CW Win*Hin/8 , _glcd_rad   
                                    '     banksel   _glcdbm
                                    '     movlw low BMin
                                    '     movwf _glcdbm
                                    '     movlw high BMin
                                    '     movwf _glcdbm +1
                                    '     BANKSEL 0
                                    '     L?CALL  _ssd_bitmap
                                    '      endm
    
    
    pause 1000               'WE GET STUCK HERE!!!
    gosub grf_clr
    gosub show
    pause 1000
          
    goto main             
     
     
    end
    
    logo64:             '64x64 image
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 112, 60, 28, 6, 7, 3
    @ db   3, 7, 6, 14, 28, 112, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 248, 254, 7, 7, 3, 3, 3, 3
    @ db   3, 6, 2, 6, 4, 12, 136, 184, 23, 33, 64, 64, 0, 128, 0, 0
    @ db   0, 0, 0, 128, 64, 32, 33, 23, 120, 136, 12, 4, 4, 6, 2, 3
    @ db   3, 3, 3, 3, 7, 6, 254, 252, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 2, 7, 60, 224, 128, 128, 128, 128
    @ db   0, 64, 0, 64, 0, 64, 110, 0, 32, 0, 64, 32, 32, 8, 33, 2
    @ db   6, 9, 32, 16, 0, 32, 128, 32, 0, 21, 96, 0, 64, 64, 0, 64
    @ db   128, 128, 128, 128, 224, 28, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   192, 224, 120, 24, 28, 4, 6, 2, 3, 0, 1, 0, 1, 6, 8, 16
    @ db   32, 0, 192, 0, 32, 154, 4, 0, 1, 128, 224, 248, 248, 252, 252, 254
    @ db   252, 252, 252, 252, 248, 224, 64, 1, 2, 0, 73, 16, 64, 128, 0, 64
    @ db   32, 8, 6, 1, 1, 1, 1, 3, 2, 6, 12, 12, 56, 112, 240, 192
    @ db   3, 15, 30, 24, 60, 96, 96, 64, 192, 128, 128, 128, 128, 64, 60, 12
    @ db   2, 1, 0, 2, 0, 0x2C, 144, 0, 0, 0, 15, 31, 31, 63, 127, 63
    @ db   127, 63, 63, 31, 31, 15, 1, 128, 0, 32, 0x94, 8, 2, 0, 1, 2
    @ db   8, 16, 96, 128, 0, 128, 128, 64, 64, 96, 96, 60, 24, 14, 15, 3
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 128, 240, 56, 7, 1, 1, 1, 0
    @ db   3, 0, 2, 2, 4, 2, 234, 4, 0, 1, 4, 4, 0, 12, 144, 64
    @ db   64, 36, 152, 0, 4, 2, 0, 4, 0, 178, 6, 0, 2, 2, 2, 2
    @ db   0, 1, 1, 1, 7, 28, 240, 128, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 31, 127, 240, 192, 192, 192, 192, 192
    @ db   192, 192, 32, 96, 32, 16, 16, 31, 248, 132, 4, 2, 1, 0, 0, 0
    @ db   0, 0, 0, 1, 2, 4, 132, 120, 31, 16, 60, 32, 32, 96, 64, 192
    @ db   192, 192, 192, 192, 224, 112, 127, 63, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 14, 60, 60, 112, 224, 192
    @ db   192, 224, 112, 112, 24, 30, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    Name:  20240221_175556.jpg
Views: 861
Size:  480.6 KB
    Shawn

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,440


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    there is no need to modify the include

    the correct usage is


    DMDBMP 0,0,logo64

    bmp's need a header to set width and height


    Code:
    logo64:             '64x64 image
    @ db   64,64 //  header width,height
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 112, 60, 28, 6, 7, 3
    @ db   3, 7, 6, 14, 28, 112, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 248, 254, 7, 7, 3, 3, 3, 3
    @ db   3, 6, 2, 6, 4, 12, 136, 184, 23, 33, 64, 64, 0, 128, 0, 0
    @ db   0, 0, 0, 128, 64, 32, 33, 23, 120, 136, 12, 4, 4, 6, 2, 3
    @ db   3, 3, 3, 3, 7, 6, 254, 252, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 2, 7, 60, 224, 128, 128, 128, 128
    @ db   0, 64, 0, 64, 0, 64, 110, 0, 32, 0, 64, 32, 32, 8, 33, 2
    @ db   6, 9, 32, 16, 0, 32, 128, 32, 0, 21, 96, 0, 64, 64, 0, 64
    @ db   128, 128, 128, 128, 224, 28, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   192, 224, 120, 24, 28, 4, 6, 2, 3, 0, 1, 0, 1, 6, 8, 16
    @ db   32, 0, 192, 0, 32, 154, 4, 0, 1, 128, 224, 248, 248, 252, 252, 254
    @ db   252, 252, 252, 252, 248, 224, 64, 1, 2, 0, 73, 16, 64, 128, 0, 64
    @ db   32, 8, 6, 1, 1, 1, 1, 3, 2, 6, 12, 12, 56, 112, 240, 192
    @ db   3, 15, 30, 24, 60, 96, 96, 64, 192, 128, 128, 128, 128, 64, 60, 12
    @ db   2, 1, 0, 2, 0, 0x2C, 144, 0, 0, 0, 15, 31, 31, 63, 127, 63
    @ db   127, 63, 63, 31, 31, 15, 1, 128, 0, 32, 0x94, 8, 2, 0, 1, 2
    @ db   8, 16, 96, 128, 0, 128, 128, 64, 64, 96, 96, 60, 24, 14, 15, 3
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 128, 240, 56, 7, 1, 1, 1, 0
    @ db   3, 0, 2, 2, 4, 2, 234, 4, 0, 1, 4, 4, 0, 12, 144, 64
    @ db   64, 36, 152, 0, 4, 2, 0, 4, 0, 178, 6, 0, 2, 2, 2, 2
    @ db   0, 1, 1, 1, 7, 28, 240, 128, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 31, 127, 240, 192, 192, 192, 192, 192
    @ db   192, 192, 32, 96, 32, 16, 16, 31, 248, 132, 4, 2, 1, 0, 0, 0
    @ db   0, 0, 0, 1, 2, 4, 132, 120, 31, 16, 60, 32, 32, 96, 64, 192
    @ db   192, 192, 192, 192, 224, 112, 127, 63, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 14, 60, 60, 112, 224, 192
    @ db   192, 224, 112, 112, 24, 30, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0
    @ db   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    Warning I'm not a teacher

  5. #5
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    That gets me closer, in the sense I figured it needed specified somewhere! But it doesn't correctly display the image. I have reverted back to non-edited include files. Thoughts? Thank you for your assistance!!!

    Name:  20240221_190246.jpg
Views: 855
Size:  454.3 KB
    Shawn

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,440


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    ah! the bmps are in a different format the byte are now laid out horizontally
    i also discovered the dmp code upsets the font height [did have a shared variable]
    i used lcdassistant to generate bmps

    some files to play with

    Name:  borris.jpg
Views: 892
Size:  20.5 KB
    Attached Files Attached Files
    Warning I'm not a teacher

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,440


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    glcd tools also works well in generating bmp's
    and formats the data nicely
    Name:  glt.jpg
Views: 877
Size:  168.0 KB
    Warning I'm not a teacher

Similar Threads

  1. SSD1306 Include example
    By timc in forum Code Examples
    Replies: 11
    Last Post: - 28th November 2017, 08:53
  2. SSD1306 start display problem
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2016, 19:16
  3. Using INCLUDE to add a text file in PBP3
    By Sumobob in forum PBP3
    Replies: 4
    Last Post: - 16th May 2016, 18:56
  4. PBP3 to include 18F97J94?
    By fowardbias in forum PBP3
    Replies: 1
    Last Post: - 18th December 2013, 16:42
  5. Help With OLED Display / 128X64 SSD1306
    By Denner in forum General
    Replies: 6
    Last Post: - 25th May 2013, 15:40

Members who have read this thread : 23

You do not have permission to view the list of names.

Posting Permissions

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