SSD1306 INCLUDE for PBP3


Closed Thread
Results 1 to 40 of 102

Hybrid View

  1. #1
    Join Date
    Feb 2024
    Posts
    1


    0 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    Thanks for information

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


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    Richard, I am hoping you can help me with an issue I am having making your SSD1306 driver work. Everything is working well except when I display a bitmap with the y axis not set at 0 it cuts the image in half. I have tried with every version of the ssd1306_I2C.INC found in this thread with the same result. Posted here is the code with a simple 16x16 bitmap icon and an image of it displayed at both y=0 and y=4. Any chance you can help sort what is going on here?

    Code:
     '****************************************************************
    '*  Name    : ssd1306_DEMO.PBP                                   *
    '*  Author  : richard                                            *
    '*  Notice  :                                                    *
    '*          :                                                    *
    '*  Date    : 19/11/2017                                         *
    '*  Version :                                                    *
    '*  Notes   :                                                    *
    '*          :FOR pic 18F26K22              SSD1306               *
    '****************************************************************
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  PLLCFG = ON
      CONFIG  PRICLKEN = OFF
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRTEN = OFF
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 190
      CONFIG  WDTEN = ON
      CONFIG  WDTPS = 32768
      CONFIG  CCP2MX = PORTC1
      CONFIG  PBADEN = OFF
      CONFIG  CCP3MX = PORTB5
      CONFIG  HFOFST = ON
      CONFIG  T3CMX = PORTC0
      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
    DEFINE OSC 64 
    OSCCON = %11110000           
    
    char var byte
    x    var byte  
    y    var byte    
    BUFF VAR BYTE[16]          
    
    ANSELb = 0
    ANSELA = 0
    ANSELC = 0
    
    ;use this define for hw i2c 
    #define hwi2c 1           'SCL=C.3 & SDA=C.4
    
    ;set and uncomment these to use softi2c
    'SCL var PortC.3      ' I2C Clock
    'SDA var PortC.4      ' I2C Data
    
    ;set these  to match display
    ssdheight con 7      ; 7 = 8 PAGES  64*128 ,  3 = 4 pages 32*128
    ssdwidth  con 127    ; 128 PIXELS WIDE
    sdd1306_addr con $78
    Include "ssd1306_I2C.INC"  ' bring it in
    include "font7x5_18.bas"
    
    
    '==========================    MAIN  Routine    ==============================
    
    pause 100
    gosub glcd_init
    GLCD_CLR
    BIG_TEXT = 0
    
    main: 
        SSDBM 112,0,16,16 ,StallIcon ;x,y,w,h,label   Y=0 (DISPLAYS OK)
    '    pause 100
    '    SSDBM 112,0,16,16 ,BlankIcon ;x,y,w,h,label                  
    
    '    SSDBM 112,2,16,16 ,StallIcon ;x,y,w,h,label   Y>0 (DISPLAYS HALF OF IMAGE)
    '    pause 100                    
    '    SSDBM 112,2,16,16 ,BlankIcon ;x,y,w,h,label                 
    
        SSDBM 112,4,16,16 ,StallIcon ;x,y,w,h,label   Y>0 (DISPLAYS HALF OF IMAGE)
        pause 1000
    '    SSDBM 112,4,16,16 ,BlankIcon ;x,y,w,h,label               
    
    '    SSDBM 112,6,16,16 ,StallIcon ;x,y,w,h,label   Y>0 (DISPLAYS HALF OF IMAGE)
    '    pause 100
    '    SSDBM 112,6,16,16 ,BlankIcon ;x,y,w,h,label           
    goto main    
    end   
    
    StallIcon:    '16x16 BMP image
    @ db   248, 4, 226, 241, 57, 25, 25, 193, 241, 121, 25, 25, 241, 226, 4, 248
    @ db   15, 16, 35, 71, 78, 76, 78, 71, 67, 64, 76, 78, 71, 35, 16, 15
    
    
    BlankIcon:    '16x16 BMP 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, 0, 0, 0, 0, 0, 0, 0
    Name:  20240219_110646.jpg
Views: 2025
Size:  347.2 KB
    Shawn

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    Any chance you can help sort what is going on here?
    yep, i never did test with other than 64x64 bmps, that masked the fault
    now we know it works with 64x64 and 16x16 bmps at least

    there is a defect in the include file, the bmp usercommand macro is not quite right

    in the include file the bit in red needs to be added in

    Code:
    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
    Last edited by richard; - 21st February 2024 at 01:43.
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    latest version
    Attached Files Attached Files
    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

    Thank you, Richard! That works perfectly! You have no idea how much time I spent attempting to fix that.

    One other request. I am struggling to understand the macros but would like one that can do a point to point line. Something that would do x1,y1 to x2,y2. Can you assist with adding a macro to accomplish this?
    Shawn

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


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    One other request. I am struggling to understand the macros but would like one that can do a point to point line.
    not possible with this small footprint method , horizontal and vertical lines is the best it can do

    if you want full graphics use this
    https://www.picbasic.co.uk/forum/sho...741#post146741
    Warning I'm not a teacher

  7. #7
    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

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 : 7

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