SSD1306 OLED (72x40) I2C display from scratch


Closed Thread
Results 1 to 40 of 74

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: SSD1306 OLED (42x40) I2C display from scratch

    i'm not seeing a font , i had a look at a 40x18 font this morning with my new 72x40 that just arrived
    encoded this way seems the best compromise for easy of unpacking into a 18 x 5 byte stream to send to display

    Name:  fonts.jpg
Views: 15005
Size:  273.3 KB
    Name:  40x18.jpg
Views: 14955
Size:  52.2 KB







    i dont like most of you inital sfr settings
    i would replace the entire section with
    OSCCON = $70 ;% 01110000 'Internal RC set to 8MHZ


    for these reasons
    OPTION_REG = % 10000000 'PORT A&B Pull-Ups disabled (see WPUA & WPUB)
    Pull-Ups are set that way by default anyway . that does other things to that may later prove to be incorrect Like set int edge to falling, reassign and alter the prescaler, change timer 0 clock source

    OSCCON = % 11100000 'Internal RC set to 8MHZ
    no 'OSCCON = % 01110000 for 8mhz you have set it for 4 mhz


    ANSEL = % 00010100 'Select analog inputs Channels 0 to 7 (AN2 + AN4 selected)
    ok but you then go on to make those pins be digital outputs , not recommended except for smoke generation if used as analog inputs


    ADCON0 = % 10000000 'A/D Module (Bit5:2 select channels 0:11)
    ADCON1 = % 00000000 'A/D control register
    why ? makes no sense adc is off by default


    CM1CON0 = % 00000000 'Comparator1 Module is OFF
    CM2CON0 = % 00000000 'Comparator2 Module is OFF
    why ? Comparator 1 and 2 Modules are OFF by default


    INTCON = % 00000000 'INTerrupts CONtrol (TMR0 OFF)
    why serves no purpose ints are off by default


    TRISA = % 00000000 'Set Input/Output (0 to 5)
    bad call when an2
    TRISB = % 00000000 'Set Input/Output (4 to 7)
    bad call when 4,6 used for i2c
    TRISC = % 00000000 'Set Input/Output (0 to 7)
    bad call when an4


    why ? i2c pins can left as be inputs
    when breadboarding leave unused pins as inputs. fine set them as low outputs for the "production" version if a few microwatts of power dissipation makes a difference



    PORTB = % 00000000 'Ports High/Low (4 to 7)
    why ? i2c pins being set low is not useful
    Warning I'm not a teacher

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


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

    Default Re: SSD1306 OLED (42x40) I2C display from scratch

    i have tried a 14x10 , a 14x10 doubled to 28x20
    a 13x7 doubled to 26x14 and tripled to 39x21
    they all work ok. imho by leaps and bounds a 40x18 full size font looks best and is only 540 words for ten digits

    Last edited by richard; - 9th December 2023 at 07:12.
    Warning I'm not a teacher

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default SSD1306 OLED (72x40) I2C display from scratch

    Richard,

    You're absolutely right about the useless register settings I mention in my code.

    Most of them, if not all, just reflect their default state as per datasheet.

    This is because I use a pic specific template so they are there everytime I start a new project and ready to be deleted in case of no use

    BTW, your video looks great!!
    Roger

Similar Threads

  1. big char oled display
    By mombasa in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th September 2020, 07:02
  2. SSD1306 start display problem
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2016, 19:16
  3. Cannot drive I2C Oled :(
    By elcrcp in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 20th August 2016, 12:19
  4. OLED Display Noise problem
    By gunayburak in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 5th July 2016, 10:15
  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 : 1

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