I guess it's in help somewhere but can someone tell me the easiest way to connect and use two ssd1306 displays and print/plot/draw to each independently.
uno has one hardware i2c. my 18f25k22 has two?
showing my ignorance. please help me use 2 glcds.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The process is relatively simple but the SSD1306 has many operational modes and these modes place constraints on the solution.
This is not a big piece of work. To retain all the capabilities of GLCD commands. Should take about 60 minutes.
To enable more than one device, you have lots of devices. I2C is not the issue, read on.
Connect up device #1, test and save test program. Leave device connected.
Connect up device #2, test and save test program with another name.
We now know that both displays are working, indepently. We know the addresses and we know the initialistion process is ok. Note: I2C or SPI this is not important. You just need the two displays operating with two diffferent programs.
Now the interesting part. Do not change anything in the include folder!
Create new program.
Move chip and communications details from one of the working test programs.
change glcd_type to 0
add the new key constants
add the following methods for init, dislplay selection and communications. Taken from the existing library. These methods are adapted to support display selection only. I called all these local methods. Need to add select the screen and adapt init, cls, and pset.
a. local_display selection - preselects the screen
b. local_init... inits each screen
c. local_glcdcls ... cls each screen, or, more than one at the same time
d. local_pset ... I had to adapt this as some clown in the past had placed a constraint in the original driver. I was that clown but i have a rule not to change the libraries!
e. the SSD1306 may need this, or, more, but, it is the same.
Create demo GLCD code, test and enjoy more than one screen.
This method works. Gives a nice result. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/889fb8c0/ the same process for a different display but the device, the communication protocol are not critical is the enablement process. This is not reallly my idea - I have taken this from watching Hugh write programs over the last few years!
As the SSD1306 is a double buffered screen, in terms of RAM, I am sure you have already figured out that the display RAMis shared between the displays and therefore the constraints this will have on your outcome.
If you want double buffered twin screens with GLCD capabilities... Take glcd.h and ssd1306.h and rewrite the methods you need. And, this could use up to 2048 bytes of RAM and take a few more hours to sort.
So, before, I go any further. Still interested?
Last edit: Anobium 2017-11-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems not trivial idea. I had forgot about the 1K ram buffer. oops.
So 2 spi glcds then that don't need ram the 18f25k22 data sheet says
2-UART, 2-SPI, 2-I2C2-MSSP(SPI/I2C)
Each display would have a different address?
First time I thought about >1 display. I'll look through help and demos more. Cheers.
Mike "simple as HI2C2 ?" There's only one on a uno. I could use software but never tried that. I've seen two ssd1306 connected to uno somewhere and more could be added but can't remember where.
Last edit: stan cartwright 2017-11-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just added multiple missiles to sprite demo. Mission to mars on tv... again. Had to add a counter to stop all missiles at once. not a debounce prob.
15146 bytes used so could do more. l8r
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess it's in help somewhere but can someone tell me the easiest way to connect and use two ssd1306 displays and print/plot/draw to each independently.
uno has one hardware i2c. my 18f25k22 has two?
showing my ignorance. please help me use 2 glcds.
Stan, Isn't it as simple as HI2C2 ?
Look in your Include/lowlevel.
Did this last week. Should be relatvely easy.
What are tryng to achieve?
The process is relatively simple but the SSD1306 has many operational modes and these modes place constraints on the solution.
This is not a big piece of work. To retain all the capabilities of GLCD commands. Should take about 60 minutes.
To enable more than one device, you have lots of devices. I2C is not the issue, read on.
We now know that both displays are working, indepently. We know the addresses and we know the initialistion process is ok. Note: I2C or SPI this is not important. You just need the two displays operating with two diffferent programs.
Now the interesting part. Do not change anything in the include folder!
a. local_display selection - preselects the screen
b. local_init... inits each screen
c. local_glcdcls ... cls each screen, or, more than one at the same time
d. local_pset ... I had to adapt this as some clown in the past had placed a constraint in the original driver. I was that clown but i have a rule not to change the libraries!
e. the SSD1306 may need this, or, more, but, it is the same.
This method works. Gives a nice result. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/889fb8c0/ the same process for a different display but the device, the communication protocol are not critical is the enablement process. This is not reallly my idea - I have taken this from watching Hugh write programs over the last few years!
See here for the demonstation code. https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources/tree/master/GLCD%20%20Solutions/GLCD%20Dual%20Display%20Solutions/GLCD8544%20Display
As the SSD1306 is a double buffered screen, in terms of RAM, I am sure you have already figured out that the display RAMis shared between the displays and therefore the constraints this will have on your outcome.
If you want double buffered twin screens with GLCD capabilities... Take glcd.h and ssd1306.h and rewrite the methods you need. And, this could use up to 2048 bytes of RAM and take a few more hours to sort.
So, before, I go any further. Still interested?
Last edit: Anobium 2017-11-26
Seems not trivial idea. I had forgot about the 1K ram buffer. oops.
So 2 spi glcds then that don't need ram the 18f25k22 data sheet says
2-UART, 2-SPI, 2-I2C2-MSSP(SPI/I2C)
Each display would have a different address?
First time I thought about >1 display. I'll look through help and demos more. Cheers.
Mike "simple as HI2C2 ?" There's only one on a uno. I could use software but never tried that. I've seen two ssd1306 connected to uno somewhere and more could be added but can't remember where.
Last edit: stan cartwright 2017-11-26
Should only take an hour. I truly did this Wednesday evening while watching The Apprentice.
RAM is to do with the SSD1306 nothing to do with I2C (which is the communication protocol).
Yes. Each address would have a different address - hence, confirming things with the two test programs.
Enjoy.
I just added multiple missiles to sprite demo. Mission to mars on tv... again. Had to add a counter to stop all missiles at once. not a debounce prob.
15146 bytes used so could do more. l8r
How come this guy makes it look so simple? https://www.youtube.com/watch?v=yef23sJjiU0
and this looks cool https://www.youtube.com/watch?v=oi30pz3viSw&t=2s
lots of arduino youtube vids. my thoughts have been gcb can do that.
Why not (1 display) https://www.youtube.com/watch?v=tCmaOb-VAEo&t=3s
Last edit: stan cartwright 2017-11-30
It is easy. It is adaption of existing libraries as I described above.