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 CCS Technical Support

0.96 inch LCD IIC module

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rudy



Joined: 27 Apr 2008
Posts: 167

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

0.96 inch LCD IIC module
PostPosted: Mon Sep 21, 2015 7:00 am     Reply with quote

Does anybody can give a tip regarding of simple program, just to light one pixel is enough, of LCD with SSD1306 controller, without any library, I want to make my on code.

Regards.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 21, 2015 7:04 am     Reply with quote

simple, yes, easy well that all depends.

Just read the datasheet for the LCD module you have and see what the commands are.Usually the manufacturer will have 'sample' programs either in the datasheet or posted on their website.

I'm assuming the LCD controller/module is 3 volts so I'd use a 3 volt PIC to simplify the hardware to just PIC and controller otherwise running a 5 volt PIC with a 3V device will be costly.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Mon Sep 21, 2015 7:18 am     Reply with quote

Seriously, just look at some of the driver attempts posted here. For example:

<http://www.ccsinfo.com/forum/viewtopic.php?t=52836&highlight=ssd1306>

Key is that the basic functions to send data and commands, here are only a handful of lines, and are easy for you to either use, or re-write for your own needs. Then the initialisation sequence is straight from the data sheet, and also shown, so all that is left, is to send the command/data to turn on the required pixel.
rudy



Joined: 27 Apr 2008
Posts: 167

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

PostPosted: Mon Sep 21, 2015 10:00 am     Reply with quote

temtronic wrote:
simple, yes, easy well that all depends.

Just read the datasheet for the LCD module you have and see what the commands are.Usually the manufacturer will have 'sample' programs either in the datasheet or posted on their website.

I'm assuming the LCD controller/module is 3 volts so I'd use a 3 volt PIC to simplify the hardware to just PIC and controller otherwise running a 5 volt PIC with a 3V device will be costly.

Jay


Yes, thank you. I am using 3V.
MikeW



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

View user's profile Send private message

PostPosted: Tue Sep 22, 2015 1:58 pm     Reply with quote

rudy,

I spent ages trying to get it to work properly.

All of the Arduino etc drivers allocate 1K RAM, and the various font/line/circle routines just write to the ram buffer, then dump the 1K into the SD1306.

The SD1306 is addressed as 8 pages of 8 lines ( from recollection).

1K RAM is tough in PIC's easy in ARM or any Atmel avr.

I had a go, and it sort of worked.

if you pm me, i will send you what I have.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Tue Sep 22, 2015 2:08 pm     Reply with quote

Yes.

This is the common problem about displays. To 'change' something like a pixel, unless you use a RAM buffer, you have to read back each byte you are wanting to alter, then write this back. On this device, using I2C, this involves sending the command to read from the memory, sending the address, then switching to read, and reading the byte back, then making the change to the byte, sending the command to write, sending the address again (since it automatically increments), and writing the byte back. Ouch.
Whereas since the address autoincrements, if you have a copy of the display in RAM, you can just make the change on the buffer and write this sequentially to the display.
rudy



Joined: 27 Apr 2008
Posts: 167

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

PostPosted: Tue Sep 22, 2015 4:41 pm     Reply with quote

OK!!

But this is not what I am seeking for! Sorry to say that, but it seems to me that Arduino tries to jump a little of the knowledge. It seems like a shake-and-bake solution. I see many people that don´t really understand what is going on, doing some kind of complex things, it is not bad for one side, but the drawback is that some people don´t think too much, this is my feeling, may be wrong.
I just looking for the initialization of the LCD, some Friend in the top says, “Read the datasheet”, and he is completely right about this. In fact, I am only trying to save some time, but I am sure that is possible to do the routine much more DRY, without these lots of ready solution. I will follow his advice and, when I have time, I will post here my solution, not a shake-and-bake one.
Thanks for all help and please don´t misunderstand my words, ok?
Best Regards.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Wed Sep 23, 2015 1:07 am     Reply with quote

The reason the Arduino does it that way, is for speed.

The basic operations to send a data/control byte/word to the display, are half a dozen line routines, and are in the code I pointed to. There is no reason at all, given these, that for a simple routine to 'set a pixel', can't be generated (though you are going to have to send quite a lot of initialisation first to configure the chip - the routine to do this is also in the code I pointed to). With the chip initialised, and the display cleared, setting a pixel just becomes a matter of writing a byte with the required bit set into a specific address.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sat Oct 10, 2015 4:55 am     Reply with quote

As an 'add on' to this, I've just posted a modified driver for this chip into the code library.

<http://www.ccsinfo.com/forum/viewtopic.php?t=54453>

This allows you to use it as a _text_ LCD, with very little RAM.
Included with this is a 'bargraph' function that allows a bar to be drawn using special characters from the font.

Or to define a graphic window, and then use text elsewhere, and draw small graphics into this window (example with 64*16 included). You can draw using the same window, one set of graphics, put this on the screen, and then another set somewhere else.

Then finally, I've included a minimum program to just set a pixel using the raw functions I've provided. Take them apart and write your own, if you don't want my library. Smile

The key point is that this allows stuff to be put on this display using only a little RAM.

It's also more efficient than the existing drivers. Nobody seems to have realised that you can burst transmit the setup commands as well as the actual data. This driver does this.

Remember this chip is a 3.3v device.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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