SSD1306 INCLUDE for PBP3


+ Reply to Thread
Results 1 to 40 of 102

Hybrid View

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

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

  3. #3
    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: 2236
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: 2215
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: 2260
Size:  213.0 KB

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

    Name:  SSD1306_4.png
Views: 2284
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.

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

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

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


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    try this
    Code:
    glcd_clrxy:    ' clear area  x1y1 to x2 y2    
        FOR GRX = 0 TO 31
            glcd_buff[GRX] = glcdData
        NEXT
        CTEMP = (1 + GX_ - GX)*(1 + GY_ -  GY)
        gosub   setxy
        glcd_rad=32
        for GRX = 0 to   CTEMP/32
            gosub ssd_data
        next
        glcd_rad = CTEMP//32
        IF glcd_rad  THEN
            gosub ssd_data
        ENDIF
    return
    Warning I'm not a teacher

  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

    Thank you Richard!
    Replacing the glcd_clrxy subroutine with that from post #38 seems to have fixed it.
    It also seems to have made GLCD_BAR more predictable but I have not looked into how they're interconnected.

    I also got the two Label after column 1 warnings (GLCDS_BAR_?CCBWC) etc but it turns out that there's a whitespace infront of those two macro labels on the include file. There was also an ELSE in column 1 causing another warning.

    I need to spend some time trying to figure out how it does it's things, would like to be able to add a slightly larger font for example. Guessing I need to replace/change the unpack routine - at the very least.

    This SSD1306-driver saved me alot of time, much appreciated Richard!

    /Henrik.

  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

    I also got the two Label after column 1 warnings (GLCDS_BAR_?CCBWC) etc but it turns out that there's a whitespace infront of those two macro labels on the include file. There was also an ELSE in column 1 causing another warning.

    i had a look at the org file i posted and it has the same errors, i always have trouble with white space


    also found 2017 version where the glcd_clrxy routine was ok, so i must have broken it when i added the bar stuff



    this is better
    Code:
    glcd_clrxy:    ' clear area  x1y1 to x2 y2   
       FOR GRX = 0 TO 31
            glcd_buff[GRX] = glcdData
        NEXT
        CTEMP = (1 + GX_ - GX)*(1 + GY_ -  GY)
        gosub   setxy
        glcd_rad=32
        GRX = CTEMP/32
        while grx
            gosub ssd_data
            grx=grx-1
        wend
        glcd_rad = CTEMP//32
        IF glcd_rad  THEN
            gosub ssd_data
        ENDIF
    return
    Attached Files Attached Files
    Last edited by richard; - 14th March 2021 at 12:54.
    Warning I'm not a teacher

  9. #9
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 INCLUDE for PBP3

    I'm trying to run this on 16F886
    and getting error
    ASM Symbol not previously defined FSR1L Error 113

    Any ideas?

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