CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SSD1306 driver for use with less RAM
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
berel



Joined: 20 Oct 2011
Posts: 15

View user's profile Send private message

PostPosted: Wed Jun 24, 2020 10:07 am     Reply with quote

Hello Ttelmah,
thanks for adding additional explanations !!!
It makes fun using the OLEDS, even the small 128x32 one, also for debugging very helpful.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Mon Jun 07, 2021 9:38 am     Reply with quote

@Ttelmah

I tried the revised bargraph routine.
When ctr is =100, I still get a blank at the end.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Jun 09, 2021 6:07 am     Reply with quote

You realise that you need both the code change, and the alteration to the
font used?. The right hand closing character has to be changed to make it
work.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Sun Jun 13, 2021 8:52 am     Reply with quote

@Ttelmah

That fixed it, thank you.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jun 14, 2021 11:02 pm     Reply with quote

Goodly. Very Happy

Have fun
blowtorch



Joined: 11 Jun 2013
Posts: 35
Location: Cape Town

View user's profile Send private message

128 x 32 changes
PostPosted: Fri Aug 27, 2021 12:49 pm     Reply with quote

Hi Ttelmah

Thank you for your great library - I have it working with a tiny 128 x 32 display. The changes required for this was to modify the value in the init_sequence for the command S_SETCOMPINS. This is command 0xDA. Change the value (next byte) from 0x12 to 0x02. If this is not done the vertical spacing is off.

And of course the define S_LCDHEIGHT should be changed to 32.

Thanks again for all your work and willingness to share.
hsogukpinar



Joined: 20 Sep 2021
Posts: 8

View user's profile Send private message Send e-mail

ssd1309 library code
PostPosted: Tue Sep 21, 2021 12:12 am     Reply with quote

Ttelmah wrote:
As an update, I've just been running this with the SSD1309 (gives larger displays like 2.4"), and it runs fine. Only thing that gave problems was I found these needed a reset signal to stay low for a little while after power was applied to work reliably (ended up using a capacitor on the RES line), for reliable operation. Because this takes time, I had to pause for longer at boot. With this done works well. Smile


Can you please share the SSD 1309 display code
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Sep 23, 2021 5:03 am     Reply with quote

It is the same code.
Provided you have the SSD1309 wired for I2C comms, and with the caveat
about needing a reset to the chip (either a resistive/diode/capacitive reset
to the controller chip or another PIC line to operate the reset signal).
Obviously you need to pause at the start till the reset is done, and then
about another 20mSec.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Wed Aug 24, 2022 8:54 am     Reply with quote

@hsogukpinar

Just bought a 1309 display.

What value of reset capacitor would you suggest ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Sep 07, 2022 6:18 am     Reply with quote

Not who you were asking.

Look at figure 8.16 in the data sheet.
Note the level on RES can be high or low to the left. The point is it
must not go up to high till at least 3uSec after Vdd, and Vcc must
rise after this.
Some fiddling with capacitor values needed, depending on your supply.
paulie2907



Joined: 25 Jun 2020
Posts: 5

View user's profile Send private message

height problem
PostPosted: Mon Mar 13, 2023 8:17 pm     Reply with quote

Ttelmah : I use your metod, it work with some edit. But bottom side is showing some pixel and Y adreses not work for me (work but not idealy), i can´t find proble. ... look

driver set (for check)
Code:
//directly from the data sheet - commands - not all used
#define S_EXTERNALVCC            0x01
#define S_SWITCHCAPVCC           0x02
#define S_SETLOWCOLUMN           0x00
#define S_SETHIGHCOLUMN          0x10
#define S_MEMORYMODE             0x20
#define S_COLUMNADDR             0x21
#define S_PAGEADDR               0x22
#define S_SETSTARTLINE           0x40
#define S_ROWADDRESS             0xB0//----------------
#define S_SETCONTRAST            0x81
#define S_CHARGEPUMP             0x8D
#define S_SEGREMAP               0xA0//A0
#define S_DISPLAYALLON_RESUME    0xA4
#define S_DISPLAYALLON           0xA5
#define S_NORMALDISPLAY          0xA6
#define S_INVERTDISPLAY          0xA7
#define S_SETMULTIPLEX           0xA8
#define S_DISPLAYOFF             0xAE
#define S_DISPLAYON              0xAF
#define S_COMSCANINC             0xC0
#define S_COMSCANDEC             0xC8
#define S_SETDISPLAYOFFSET       0xD3
#define S_SETCOMPINS             0xDA
#define S_SETVCOMDETECT          0xDB
#define S_SETDISPLAYCLOCKDIV     0xD5
#define S_SETPRECHARGE           0xD9
#define DIV_RATIO                0xA0//recommended ratio
#define MULTIPLEX                0xA0 //and multiplex
#define INT_VCC                  0x14


ROM BYTE init_sequence[] = S_DISPLAYOFF,
       S_SETDISPLAYCLOCKDIV,
       DIV_RATIO,                 
       S_SETMULTIPLEX,
       MULTIPLEX,
       S_SETDISPLAYOFFSET,
       0,                                   // no offset
       S_SETSTARTLINE,
       S_CHARGEPUMP,
       INT_VCC,                             // using internal VCC
       S_MEMORYMODE,                        //Since byte is vertical writing column by column
       0,                                   // default horizontal addressing
       (S_SEGREMAP | 0x01),                  // rotate screen 180
       S_COMSCANDEC,                       
       S_SETCOMPINS,                 
       0x12,
       S_SETCONTRAST,
       0x8F,                                //experiment.... 0xCf for 1306/org :  0XEF
       S_SETPRECHARGE,
       0xF1,
       S_SETVCOMDETECT,
       0x40,
       S_DISPLAYALLON_RESUME,
       S_NORMALDISPLAY,
       S_DISPLAYON;                         //switch on OLED   


main
Code:

//Inicializace Displaye
void Display_init(void)
{
   output_high(POWER_LCD);                               //Zapne napájení pro LCD
   delay_ms(200);
   output_low(SSD1306_RST);                              //Resetuje LCD (logická 0)
   delay_ms(200);
   output_high(SSD1306_RST);                             //Vypne reset (logická 1)
   delay_ms(200);
   Display_Backlight(2);                                 //Nastaví MAX podsvícení
   OLED_commands(init_sequence,sizeof(init_sequence));   // Sekvence příkazů z knihovny


void main(void)
{
   // Zabliká LED při zapnutí
   for(int8 q=0; ;q<21; q++)
   {
      delay_ms(50);
      output_toggle(LED);
   }
   output_low(LED);
   Display_init();
 
   int8 ctr;
   char text[50];
   
   //First try some text
   OLED_CLS(); //clear the physical screen
   set=true;
   clear_window(); //clear the window buffer
   OLED_gotoxy(0,0);
   strcpy(text,"SERVICE MODE - Test");
   size=NORMAL;
   OLED_text(text,strlen(text));
   delay_ms(5000);
   
   //now some graphics
   line(0,1,128,1); //draw line in window
   line(0,3,128,3); //draw line in window
   line(0,5,128,5); //draw line in window
   line(0,7,128,7); //draw line in window
   line(0,9,128,9); //draw line in window
   line(0,11,128,11); //draw line in window
   line(0,13,128,13); //draw line in window
   line(0,31,128,31); //draw line in window
   //line(10,10,61,0);//and a second
   //now write the window to the screen
   draw_window(0,0); //at 64 pixels across and top of screen

   //delay_ms(5000);
   //set=FALSE; //inverted drawing
   //clear_window(); //clear the window to fully set!
   //line(0,0,60,15);
   //line(20,10,40,10);
   //circle(24,8,8,1); //just touch the edge of the window
   //draw_window(0,4); //put this window half way down screen

   delay_ms(1000);
   while (TRUE)
   {
      delay_ms(1000);
      output_toggle(LED);
   }
      ; //and stop7 bez toho to stojí na nule (do odpojení baterie);
   //OSC_Enable();
   
}


I am answering based on a previous topic in my thread :
http://www.ccsinfo.com/forum/viewtopic.php?t=59975

I have this LCD : https://www.ebay.com/itm/301220791533

This is image showing the problem (look on line Y adresses)
https://www.romar-electronic.cz/3.jpg
https://www.romar-electronic.cz/4.jpg
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Mar 14, 2023 7:29 am     Reply with quote

Have you tried with #define SH1106?.
This is needed for the chips that are offset a couple of bits away from the
origin.
paulie2907



Joined: 25 Jun 2020
Posts: 5

View user's profile Send private message

PostPosted: Tue Mar 14, 2023 8:06 am     Reply with quote

Ttelmah wrote:
Have you tried with #define SH1106?.
This is needed for the chips that are offset a couple of bits away from the
origin.


Yes i have use this define
Code:
void OLED_address(unsigned int8 x, unsigned int8 y)
{
   //routine to move the memory pointers to x,y.
   //x is 0 to 127 (column), y (row) is 0 to 7 (page only)
#ifdef SH1106
   x+=4;
#endif
   i2c_start(SSD1306_STREAM);
   i2c_write(SSD1306_STREAM, SSDADDR); //select the display   
   i2c_write(SSD1306_STREAM, COMMAND_ONLY); //we are sending command(s)
   i2c_write(SSD1306_STREAM, S_ROWADDRESS | y); //select the display row
   i2c_write(SSD1306_STREAM, S_SETLOWCOLUMN | (x & 0x0F)); //low col address
   i2c_write(SSD1306_STREAM, S_SETHIGHCOLUMN | ((x>>4) & 0x0F)); //high col address
   i2c_stop(SSD1306_STREAM);
} //also made more efficient


I must edit x to shift to 4 Smile
paulie2907



Joined: 25 Jun 2020
Posts: 5

View user's profile Send private message

PostPosted: Tue Mar 14, 2023 3:13 pm     Reply with quote

I fix "ramdomly pixel" on init display.

But display still only show half .

On code :
Code:
   line(0,0,128,0); //line UP
   line(0,0,0,31); //line left
   line(126,0,126,31); //line in right
   line(0,32,128,32); //line bottom


But fill on display work normally. Can see on image

https://www.romar-electronic.cz/5.jpg
https://www.romar-electronic.cz/6.jpg

Thanks for reply
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Mar 20, 2023 7:43 am     Reply with quote

That is not how you use the define.

All you do is before loading the driver, have the line:

#DEFINE SH1106

The driver then switches the origin and calculations it does based on this.

The big problem though is knowing how your chip actually relates to the
'real' SSD and SH chips. Do you have the actual chip number, and a link
to the data sheet for this?. Post these, and I'll see what has to be changed
in the driver.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group