SSD1306 INCLUDE for PBP3


+ Reply to Thread
Results 1 to 40 of 102

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,392


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    i havent used one of those displays for some time ,my other demo for a pic16f1619 used the mssp i2c module
    try this ,it worked on my curiosity board , plugged straight in to click socket
    Code:
     '****************************************************************
    '*  Name    : ssd1306_DEMO.PBP                                   *
    '*  Author  : richard                                            *
    '*  Notice  :                                                    *
    '*          :                                                    *
    '*  Date    : 19/11/2017                                         *
    '*  Version :                                                    *
    '*  Notes   : plugs into click port note !!!!sda/scl     swapped on click skt*
    '*          :FOR pic 16F1619             SSD1306                 *
    '****************************************************************
    #CONFIG
        __config _CONFIG1,  _FOSC_INTOSC & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
        __config _CONFIG2,  _WRT_OFF & _PPS1WAY_OFF & _ZCD_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_HI & _LVP_ON
        __config _CONFIG3,  _WDTCPS_WDTCPS6 & _WDTE_OFF & _WDTCWS_WDTCWS100 & _WDTCCS_LFINTOSC
    #ENDCONFIG
    
    
    
    
    define      OSC             32
    
    
     
    ; --- *** Oscillator  *** ---------------------------------------------------
    OSCCON = %11110000           ;32 MHz, 
    ANSELb = 0
    ANSELA = 0
    ANSELC = 0
    
    
    char var byte
    x    var byte  
    y    var byte    
    BUFF VAR BYTE[16]
    ;use this define for hw i2c 
    #define hwi2c 1 
    #DEFINE PIC16 1 
    ;set and uncomment these to use softi2c
    'SCL var PortB.4      ' I2C Clock
    'SDA var PortB.6      ' I2C Data
    RB VAR WORD
    ;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_16.bas"
    '==========================    MAIN  Routine    ==============================
    TRISB = $F0;
    PPSLOCK = $55;
    PPSLOCK = $AA;
    PPSLOCK = 0 ;     unlock PPS
    SSPCLKPPS = $0C;   //RB4->MSSP:SCL;
    SSPDATPPS = $0E;   //RB6->MSSP:SDA;
    RB6PPS = $11;   //RB6->MSSP:SDA;
    RB4PPS = $10;   //RB4->MSSP:SCL;
    PPSLOCK = $55;
    PPSLOCK = $AA;
    PPSLOCK = 1; ; lock PPS   
    
    
    gosub glcd_init
    GLCD_CLR
    BIG_TEXT = 0
    ARRAYWRITE BUFF,["READY",0]
    GLCDSTR 10,1,BUFF
    Warning I'm not a teacher

  2. #2
    Join Date
    Feb 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    unfortunately I don't get anything on the oled

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,827


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    Maybe it is nonsense this but, is there a contrast control? I had an issue once on LCD with this.

    Ioannis

  4. #4
    Join Date
    Feb 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    thanks but no, there is no contrast control. if anyone has any ideas let me know. i'll post if I ever figure it out

  5. #5
    wizard's Avatar
    wizard Guest


    Did you find this post helpful? Yes | No

    Question Re: SSD1306 INCLUDE for PBP3

    Hi Guys
    Can anyone help! I am trying to get this code to work with a 16f88 and a 128x32 OLED.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    I'm using Richards code with a small 0.96" 128x32 OLED display, soft I2C (because the 18F46K42 doesn't have the "old" MSSP module).
    I've managed to print text and variables on the screen but in order to update those values without clearing the whole screen I'm trying to figure out how to use the GLCD_CLR command to clear an area.

    I can make it do something but what it does doesn't make much sense to me. It seems to be pixel by row based but still, it's acting weirdly on me.
    For example, with the following screen as a starting point:
    Name:  SSD1306_1.png
Views: 2242
Size:  235.6 KB

    GLCD_CLR 0,0,5,1 or GLCD_CLR 0,0,10,1 does absolutely nothing while GLCD_CLR 0,0,10,2 does this:

    Name:  SSD1306_2.png
Views: 2219
Size:  216.1 KB

    GLCD_CLR 10,0,40,1 does this (which is reasonable, clearing a section of 30pixels wide, 1 row high):

    Name:  SSD1306_3.png
Views: 2264
Size:  213.0 KB

    While GLCD_CLR 10,0,41,1 does this:

    Name:  SSD1306_4.png
Views: 2286
Size:  225.1 KB

    I'm also getting strange results with the GLCD_BAR command. Anyone knows/understands what's going on here? Am I using it wrong or have I stumbled across an issue?

    /Henrik.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    Well, it turns out I don't have to worry about manually blanking out "stuff" - it just works. Still curious about the GLCD_CLR though.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,392


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    henrik
    there is a great probability i never tested it to any great extent , was just happy that it cleared to whole screen at a default setting

    this works for one line as i intended things to [you need to work around the limited size of the data buffer glcd_buff]

    Code:
    gx=5:gx_=32:gy=0:gy_=0  ;  clear from x=5 for 32 bits one line 
    gosub setxy
    j=0
    for i=0 to gx_
    glcd_buff[i]=0   ;by default the buffer is 32 bytes so be wary
    next
    glcd_rad=gx_
    gosub ssd_data
    two lines
    Code:
    gx=5:gx_=32:gy=0:gy_=1
    gosub setxy
    j=0
    for i=0 to gx_
    glcd_buff[i]=0
    next
    glcd_rad=gx_
    gosub ssd_data
    gosub ssd_data
    you may be able to figure out why the command fails , i'm just not seeing it at the present time
    Last edited by richard; - 14th March 2021 at 00:56.
    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 : 22

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