Teensy 3.2 with six 2.2 inch tft displays

Status
Not open for further replies.

sixeight

Well-known member
Is it possible to control six 2.2 inch tft displays from one teensy 3.2? I am looking at the cheap spi tft displays on ebay. There are examples on the internet of connecting one, but can you connect six or even more?

I am thinking of building a midi footcontroller with dedicated displays for every footswitch.
 
The fast ILI9341_t3 library can theoretically control up to 4. Maybe you could do the other with the slower libraries that don't depend on special pins for CS and D/C.

You're probably going to need to use buffer chips to transmit copies of those fast signals. At 24 MHz, pins 11 and 13 probably can't send 24 Mbit/sec speed to 6 places without buffers to drive the wires. Even then, the wires probably can't get really long.
 
Thanks Paul. So it is not as easy as I thought.
But using the slower library, could I use any 6 pins for CS? I was hoping to select all chips, clear them at once. Then select them one by one and write something to them.

What would you use to buffer them?

Or is it safer to go for ordinary 16x2 lcd character displays?
I am trying to build something like this:
http://www.vguitarforums.com/smf/index.php?action=dlattach;topic=15154.0;attach=13034
 
Last edited:
But using the slower library, could I use any 6 pins?

Yes, Adafruit's library uses hardware SPI, but CS and D/C are done by normal GPIO access. It doesn't use any of the special hardware features, beyond regular SPI as on all Arduino boards.

ILI9341_t3 gets its extreme speed by using the special chip select hardware and the FIFO.

I was hoping to select all chips, clear them at once. Then select them one by one and write something to them.

Well that's an interesting idea. No matter which library you use, you'll have to do some mods to the code, since they're all meant to update a single display at a time by controlling 1 CS signal.

What would you use to buffer them?

Probably 74HC125 or 74HC245 buffers. Lots of similar logic chips exist, like 74LCX, 74VHC, etc. Most should work. Adding 50 to 150 ohm series resistors can help. It's pretty much the same as with OctoWS2811 (except you want to keep it 3.3V, not increase to 5V), so you might look at the many discussions about buffer those signals.

The displays work without MISO connected, so you can get away with just transmitting signals.

If you do wire all this up and get it working, I want to see a photo!!
 
One way to do it is use 6 digi-ole 2.2" displays (http://www.digole.com/index.php?productID=1197). You would need to use the solder jumper to make these i2c devices, and then program each one to use a different i2c address. The i2c bus is somewhat slow, but since these displays have their own processor, if you are primarily doing text or simple graphics, it shouldn't be that bad, since you are only transmitting the text/commands and not the entire screen image. If you use the t3_i2c library, you should be able to run the i2c bus faster. Note, I've only used the OLED displays via UART, so I haven't used it with spi or i2c.

If you need a touchscreen, want to use an IPS screen for a wider viewing angle, and/or have more flash memory to store fonts, you can go to the 2.4" display: http://www.digole.com/index.php?productID=1212. There are other sizes of displays at the store. If you live in North America, they also ship from Canada as well as China.
 
Last edited:
PaulStoffregen;85409 You're probably going to need to use buffer chips to transmit copies of those fast signals.[/QUOTE said:
Hello Paul,

can you please explain me which signals have to be buffer? The CS?

I am planing to do quite the same thing from sixeight. I wanna drive 10(!) TFT LCD's. Is that possible with the SPI Bus? If not, it is possible to connect 2 teensys and then each one handling 5 tfts?

And the suggestion from MichaelMeissner to connect with I2C could work?

I don't need a ultra fast video interaction and I will display big color characters and maybe some forms (Triangle, Square). If I have a delay time from around 1sec I will still be happy. :)

Thank you for any help!
Cheers!
 
can you please explain me which signals have to be buffer? The CS?

I'm afraid there simply isn't a single simple, universal answer. You might not need any buffers if you put 3 or 4 displays side-by-side and connect them all with sort wires to the Teensy. Maybe. As the wires get longer and you add more displays, the need for buffers increases. For really long wires, you might also need resistors between the buffers and the wires.

This same question comes up regularly with sending LED control signals. Take a look at the OctoWS2811 page. Scroll down to "Signal Quality".

http://www.pjrc.com/teensy/td_libs_OctoWS2811.html

However, unlike those LEDs, you want to keep all the signals 3.3V. Those LEDs expect 5V signal (the other reason for a buffer), but the displays uses 3.3V.

I wanna drive 10(!) TFT LCD's. Is that possible with the SPI Bus? If not, it is possible to connect 2 teensys and then each one handling 5 tfts?

With ILI9341_t3 (which you should use), the limit is 4 per Teensy 3.2.
 
Well in theory, you could have 6 different displays connected via i2c (i2c is a shared bus). You would have to program each one to have a different i2c address (by default it uses a fixed i2c address, and I don't think there are pins to change the i2c address, so you need to load a sketch that connects up with the display at the initial address, and issues a change address command).

You would need to separately power the displays, as I suspect 6 displays might stress the Teensy's power limits.
 
I bought 3 digole displays and 2 with ILI90340c chip. I would like to give a try on the both i2c and spi possibilities.

The digole TFT are already here and I want to try the i2c and also the spi. Where do I have to change the digole library to work with teensy 3.2? And can I use other library with the digole display?

I will come again soon as I give a try connecting the displays.

Thank you!

Cheers
 
Digole library from April 2014

I haven't merged up the latest version of the library. I need to do another merge, but this is from April 2014. I have not used either i2c or SPI to drive the display. I use Serial1 (pins 0/1) to connect to the OLED displays. But hopefully it is enough to get you started.
 

Attachments

  • digoleserial.zip
    18.2 KB · Views: 120
Thank you Michael!

I took a look on your code and then changed the new Digole Library for the SPI usage.

The Demo sketch is not working properly, it beggins very quick, the turn very slow and freezed... I am using this pins here: DigoleSerialDisp mydisp(11,13,10); //SPI:pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module

I also include the Wire.h library because it was giving a error on the compiling.

Here is the whole code:
Code:
#include <Wire.h>

/*
 *This demo code will show you all functions for
 *Digole Graphic LCD adapter
 */
#define _Digole_Serial_SPI_  //To tell compiler compile the special communication only, 
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>
//--------UART setup
#if defined(_Digole_Serial_UART_)
DigoleSerialDisp mydisp(&Serial, 9600); //UART:Arduino UNO: Pin 1(TX)on arduino to RX on module
#endif
//--------I2C setup
#if defined(_Digole_Serial_I2C_)
#include <Wire.h>
DigoleSerialDisp mydisp(&Wire,'\x27');  //I2C:Arduino UNO: SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5 on UNO and Duemilanove
#endif
//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp(11,13,10);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
#endif

const unsigned char welcomeimage[] PROGMEM = {
    0, 0, 0, 0, 0, 127
    , 0, 8, 1, 2, 0, 127
    , 0, 8, 0, 148, 0, 127
    , 0, 16, 0, 89, 112, 127
    , 3, 144, 0, 16, 144, 127
    , 28, 145, 192, 16, 144, 127
    , 1, 30, 128, 80, 144, 127
    , 9, 49, 3, 208, 144, 127
    , 5, 72, 0, 80, 144, 127
    , 2, 72, 0, 150, 144, 127
    , 3, 8, 0, 152, 208, 127
    , 5, 24, 0, 64, 160, 127
    , 4, 148, 0, 64, 128, 127
    , 8, 36, 0, 128, 128, 127
    , 16, 34, 3, 240, 128, 127
    , 32, 65, 0, 14, 0, 127
    , 0, 129, 128, 1, 252, 127
    , 3, 0, 64, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
};
int ptr;
const char a[] = "disp char array";
const char b = 'Q';
int c = 3456;
String d = "I'm a string";
float pi = 3.1415926535;
double lg10;
const unsigned char fonts[] = {6, 10, 18, 51, 120, 123};
const char *fontdir[] = {"0\xb0", "90\xb0", "180\xb0", "270\xb0"};
void resetpos1(void) //for demo use, reset display position and clean the demo line
{
    mydisp.setPrintPos(0, 0, _TEXT_);
    delay(3000); //delay 2 seconds
    mydisp.println("                "); //display space, use to clear the demo line
    mydisp.setPrintPos(0, 0, _TEXT_);
}
void resetpos(void) //for demo use, reset display position and clean the demo line
{
    mydisp.setPrintPos(0, 1, _TEXT_);
    delay(3000); //delay 2 seconds
    mydisp.println("                "); //display space, use to clear the demo line
    mydisp.setPrintPos(0, 1, _TEXT_);
}

void setup() {
    mydisp.begin();
    /*----------for text LCD adapter and graphic LCD adapter ------------*/
    mydisp.clearScreen(); //CLear screen
    //mydisp.displayConfig(1);    //set config display ON, 0=off
    //mydisp.setI2CAddress(0x29);  //this function only working when you connect using I2C, from 1 to 127
    //delay(1000);
    //mydisp.setLCDColRow(16,2);  //set LCD Col and Row, only time set up is OK
    mydisp.disableCursor(); //disable cursor, enable cursore use: enableCursor();
    mydisp.drawStr(2, 0, "Demo TEXT now"); //display string at: x=4, y=0
    //Test print function
    mydisp.setPrintPos(0, 1, _TEXT_);
    mydisp.print(a); // display a char array
    resetpos();
    mydisp.print("display a char:");
    mydisp.print(b); //display a char
    resetpos();
    mydisp.print("int as DEC:");
    mydisp.print(c); //display 3456 in Dec
    resetpos();
    mydisp.print("as HEX:");
    mydisp.print(c, HEX); //display 3456 in Hex
    resetpos();
    mydisp.print("as OCT:");
    mydisp.print(c, OCT); //display 3456 in Oct
    resetpos();
    mydisp.print("BIN:");
    mydisp.print(c, BIN); //display 3456 in Bin
    resetpos();
    mydisp.print("float pi=");
    mydisp.print(pi); //display float of PI
    resetpos();
    mydisp.print("Pi6=");
    mydisp.print(pi, 6); //display PI in 6 Accuracy
    resetpos();
    mydisp.print("Pi*3=");
    mydisp.print(pi * 3, 6); //display PI time 3 in 6 Accuracy
    resetpos();
    mydisp.print("lg5=");
    mydisp.print(log(5), 8); //display log(5) in 8 Accuracy
    resetpos();
    mydisp.print(d); //display String object
    resetpos();
    for (uint8_t j = 0; j < 4; j++) //making "Hello" string moving
    {
        for (uint8_t i = 0; i < 10; i++) //move string to right
        {
            mydisp.setPrintPos(i, 1, _TEXT_);
            mydisp.print(" Hello ");
            delay(100); //delay 100ms
        }
        for (uint8_t i = 0; i < 10; i++) //move string to left
        {
            mydisp.setPrintPos(9 - i, 1, _TEXT_);
            mydisp.print(" Hello ");
            delay(100);
        }
    }
    mydisp.print("Enjoy it!");
    mydisp.enableCursor(); //enable cursor
    /*---------for Graphic LCD adapter only-------*/
    mydisp.disableCursor(); //enable cursor
    resetpos();
    mydisp.drawStr(0, 1, "Negative/flash");
    mydisp.setMode('~');
    for (uint8_t i = 0; i < 10; i++) {
        mydisp.drawBox(0, 13, 110, 13);
        delay(500);
    }
    resetpos();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "Draw image in 4 dir");
    //display image in 4 different directions, use setRot90();setRot180();setRot270();undoRotation();setRotation(dir);
    for (uint8_t i = 0; i < 4; i++) {
        mydisp.setRotation(i);
        mydisp.drawBitmap(12, 12, 41, 21, welcomeimage);
    }
    mydisp.undoRotation();
    //test setting contrast
    resetpos1();
    mydisp.drawStr(0, 0, "set contrast (This display may not support this)");
    for (uint8_t i = 0; i < 63; i++) {
        mydisp.setContrast(i);
        delay(100);
    }
    mydisp.setContrast(20);
    //test drawing a box(filled rectangle)
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw a box");
    mydisp.drawBox(20, 15, 30, 40);
    //test drawing a circle
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw a circle and a pie");
    mydisp.drawCircle(31, 31, 30);
    mydisp.drawCircle(31, 31, 14, 1);
    //test drawing a Frame
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw a Frame");
    mydisp.drawFrame(20, 15, 30, 40);
  //Clear an area use set color =0
  resetpos1();
  mydisp.clearScreen();
  mydisp.drawStr(0, 0, "Clear an area by using set color=0");
  mydisp.drawCircle(35, 70, 35, 1);
  mydisp.drawBox(80, 40, 80, 60);
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
  mydisp.setColor(0);
  mydisp.drawCircle(110, 70, 25, 1);
  mydisp.drawBox(20, 50, 40, 30);
    //test drawing Pixels
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw Pixels");
    for (uint8_t i = 0; i < 20; i++) {
        mydisp.drawPixel(20 + i * 2, 12 + random(50));
    }
    //test drawing Lines
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw Lines");
    for (uint8_t i = 0; i < 10; i++) {
        mydisp.drawLine(random(50), 12 + random(50), random(50), 12 + random(50));
    }
    //test drawing Lines to
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "draw Lines to");
    mydisp.drawLine(random(50), 12 + random(50), random(50), 12 + random(50));
    for (uint8_t i = 0; i < 10; i++) {
        mydisp.drawLineTo(random(50), 12 + random(50));
    }
    //test differnt font
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "default font");
    mydisp.setFont(fonts[0]);
    mydisp.nextTextLine();
    mydisp.print("Font 6");
    mydisp.setFont(fonts[1]);
    mydisp.nextTextLine();
    mydisp.print("Font 10");
    mydisp.setFont(fonts[2]);
    mydisp.nextTextLine();
    mydisp.print("Font 18");
    mydisp.setFont(fonts[3]);
    mydisp.nextTextLine();
    mydisp.print("Font 51");
    resetpos1();
    mydisp.clearScreen();
    mydisp.setFont(fonts[4]);
    mydisp.setPrintPos(0, 0, _TEXT_);
    mydisp.print("Font 120");
    mydisp.setFont(fonts[5]); //font 123 only have chars of space and 1 to 9
    mydisp.nextTextLine();
    mydisp.print("123");
    resetpos1();
    mydisp.clearScreen();
    //User font using number: 200,201,202,203,only available after upload to adapter
    mydisp.setFont(10);
    mydisp.drawStr(0, 0, "User font using:200,201,202,203,available after upload to adapter,16Kb space.");
    //Control backlight on/off
    resetpos1();
    mydisp.clearScreen();
    mydisp.drawStr(0, 0, "Turn backlight off after 2 seconds the on again");
    delay(2000);
    mydisp.backLightOff();
    delay(2000);
    mydisp.backLightOn();
    //move area on screen
    resetpos1();
    mydisp.clearScreen();
    mydisp.print("move area on screen");
    mydisp.drawCircle(31, 31, 14, 1);
    delay(2000);
    mydisp.moveArea(31, 31, 15, 15, 5, 8);
    //set display mode, affect all graphic functions, the available mode: "|"-or,"&"-and,"^"-xor,"!"-not,"C"-copy
    resetpos1();
    mydisp.clearScreen();
    mydisp.print("use xor or not mode to show a Circle Animation");
    mydisp.setMode('^');
    for (uint8_t i = 1; i < 31; i++) {
        mydisp.drawCircle(31, 31, i); //draw a circle
        delay(100);
        mydisp.drawCircle(31, 31, i); //disappear the previos draw
    }
    //this section show how to use enhanced TEXT position functions:
    //setTextPosBack(),setTextPosOffset() and setTextPosAbs() to make some thing fun
    resetpos1();
    mydisp.clearScreen();
    mydisp.setMode('|');
    mydisp.print("Bold D");
    mydisp.setFont(120);
    mydisp.nextTextLine();
    mydisp.print('D');
    mydisp.setTextPosBack(); //set text position back
    delay(2000);
    mydisp.setTextPosOffset(2, 0); //move text position to x+2
    mydisp.print('D'); //display D again, under or mode, it will bold 'D'
    //use setTextPosAbs() to make a Animation letter
    resetpos1();
    mydisp.clearScreen();
    mydisp.print("make > animation");
    mydisp.setFont(51);
    mydisp.setMode('C');
    for (uint8_t i = 0; i < 110; i++) {
        mydisp.setTextPosAbs(i, 45);
        mydisp.print('>');
        delay(30);
    }
    //show font in different direction
    resetpos1();
    mydisp.clearScreen();
    mydisp.setFont(fonts[1]);
    mydisp.print("show font in different direction");
    resetpos1();
    mydisp.clearScreen();
    for (uint8_t i = 0; i < 4; i++) {
        mydisp.setRotation(i);
        mydisp.setFont(fonts[2]);
        mydisp.setPrintPos(0, 0);
        for (uint8_t j = 0; j < 3; j++) {
            mydisp.setFont(fonts[2 - j]);
            if (j != 0)
                mydisp.nextTextLine();
            mydisp.print(fontdir[i]);
        }
    }
    resetpos1();
    mydisp.clearScreen();
    mydisp.setMode('~'); //set graphic Drawing Mode to COPY
    mydisp.drawHLine(0, 31, 127); //draw horizontal LiNe
    mydisp.setPrintPos(0, 31, 1); //Set Graphic position
    for (uint8_t i = 1; i <= 127; i = i + 6) //this loop will draw sin graph
    {
        mydisp.drawLineTo(i, (uint8_t) (32 - (float) (sin(i * 3.14 / 63)*28)));
    }
}
void loop() {
}

Thank you for ANY help!
 
My impression is that the clean function is not properly working and also something about the resolution is not right. Do I have to change the clock speed from the processor? I am using the quicker one (sorry I am not at home).

Schould I change it?

Thank you!
 
Is Working!

So, at home I tried to change the clock speed to 72Mhz and now is working. I tried before but only with the optimized speeds so didn't work with any of them.

I am glad to see that in my test I also changed the SS pin, instead to use the dedicated CS pin 10, I used a random one (pin 3) and still working. So, theoretically I can drive my 10's TFT without to worry to have dedicated CS pins, right?

The only weird thing on the demo sketch is that the supposedly image is not showing. I will post here my actual code:

Code:
#include <Wire.h>

/*
 *This demo code will show you all functions for
 *Digole Graphic LCD adapter
 */
#define _Digole_Serial_SPI_  //To tell compiler compile the special communication only, 
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>
//--------UART setup
#if defined(_Digole_Serial_UART_)
DigoleSerialDisp mydisp(&Serial, 38400); //UART:Arduino UNO: Pin 1(TX)on arduino to RX on module
#endif
//--------I2C setup
#if defined(_Digole_Serial_I2C_)
#include <Wire.h>
DigoleSerialDisp mydisp(&Wire,'\x27');  //I2C:Arduino UNO: SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5 on UNO and Duemilanove
#endif
//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp(11,13,3);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
#endif
#define SC_W 176  //screen width in pixels
#define SC_H 220  //screen Hight in pixels
#include "DigoleImage.h"

const unsigned char welcomeimage[] PROGMEM = {
  0, 0, 0, 0, 0, 127
    , 0, 8, 1, 2, 0, 127
    , 0, 8, 0, 148, 0, 127
    , 0, 16, 0, 89, 112, 127
    , 3, 144, 0, 16, 144, 127
    , 28, 145, 192, 16, 144, 127
    , 1, 30, 128, 80, 144, 127
    , 9, 49, 3, 208, 144, 127
    , 5, 72, 0, 80, 144, 127
    , 2, 72, 0, 150, 144, 127
    , 3, 8, 0, 152, 208, 127
    , 5, 24, 0, 64, 160, 127
    , 4, 148, 0, 64, 128, 127
    , 8, 36, 0, 128, 128, 127
    , 16, 34, 3, 240, 128, 127
    , 32, 65, 0, 14, 0, 127
    , 0, 129, 128, 1, 252, 127
    , 3, 0, 64, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
    , 0, 0, 0, 0, 0, 127
};
int ptr;
const char a[] = "disp char array";
const char b = 'Q';
int c = 3456;
String d = "I'm a string";
float pi = 3.1415926535;
double lg10;
const unsigned char fonts[] = {
  6, 10, 18, 51, 120, 123};
const char *fontdir[] = {
  "0\xb0", "90\xb0", "180\xb0", "270\xb0"};
  
void resetpos1(void) //for demo use, reset display position and clean the demo line
{
  mydisp.setPrintPos(0, 0, _TEXT_);
  delay(1500); //delay 2 seconds
  mydisp.println("                "); //display space, use to clear the demo line
  mydisp.setPrintPos(0, 0, _TEXT_);
}
void resetpos(void) //for demo use, reset display position and clean the demo line
{
  mydisp.setPrintPos(0, 1, _TEXT_);
  delay(1500); //delay 2 seconds
  mydisp.println("                "); //display space, use to clear the demo line
  mydisp.setPrintPos(0, 1, _TEXT_);
}

void setup() {
//  delay(10);  //waiting for display model ready
  mydisp.begin();
  mydisp.clearScreen(); //CLear screen
  /*----------Special function for color OLED ------------*/
  mydisp.print("Due to the limitation of memory on Arduino, we only can draw small size of color image here");
  delay(2000);
  mydisp.clearScreen(); //CLear screen
  mydisp.print("Shut down whole module after 1 second");
  delay(1000);
  mydisp.write('D');
  mydisp.write('N');
  mydisp.write('A');
  mydisp.write('L');
  mydisp.write('L');
  delay(2000);
  resetpos1();
  mydisp.clearScreen();
  mydisp.print("Adjust the Backlight");
  delay(1000);
  for(unsigned char i=0;i<=100;i+=5)
  {
    mydisp.setPrintPos(9 , 4, _TEXT_);
    mydisp.print(i); //display brightness
    mydisp.print("%");
    mydisp.setBackLight(i);
    delay(250);
  }
  delay(2000);
  mydisp.setBackLight(70);  //set brightness of backlight as 70%
  mydisp.clearScreen();
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
  mydisp.print("Draw 256 color image");
  mydisp.drawBitmap256((SC_W-120)/2,SC_H/2,120,30,digole256);  //use our image convert tool to convert, www.digole.com/tools
  delay(2000);
  mydisp.clearScreen();
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
  mydisp.print("Draw 262K color image");
  mydisp.drawBitmap262K((SC_W-70)/2,SC_H/2,70,43,eyes);
  delay(2000);
  /*----------for text LCD adapter and graphic LCD adapter ------------*/
  resetpos1();
  mydisp.clearScreen();
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
//  for(unsigned int i=0;i<65535;i++)
//  {
//    mydisp.Print::print(random(255));
//  }
  //mydisp.displayConfig(1);    //set config display ON, 0=off
  //mydisp.setI2CAddress(0x29);  //this function only working when you connect using I2C, from 1 to 127
  //delay(1000);
  //mydisp.setLCDColRow(16,2);  //set LCD Col and Row, only time set up is OK
mydisp.displayConfig(0);
mydisp.disableCursor(); //disable cursor, enable cursore use: enableCursor();
  mydisp.drawStr(2, 0, "Demo TEXT now"); //display string at: x=4, y=0
  //Test print function
  mydisp.setColor(random(254)+1);
  mydisp.setPrintPos(0, 1, _TEXT_);
  mydisp.print(a); // display a char array
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("display a char:");
  mydisp.setColor(random(254)+1);
  mydisp.print(b); //display a char
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("int as DEC:");
  mydisp.setColor(random(254)+1);
  mydisp.print(c); //display 3456 in Dec
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("as HEX:");
  mydisp.setColor(random(254)+1);
  mydisp.print(c, HEX); //display 3456 in Hex
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("as OCT:");
  mydisp.setColor(random(254)+1);
  mydisp.print(c, OCT); //display 3456 in Oct
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("BIN:");
  mydisp.setColor(random(254)+1);
  mydisp.print(c, BIN); //display 3456 in Bin
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("float pi=");
  mydisp.setColor(random(254)+1);
  mydisp.print(pi); //display float of PI
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("Pi6=");
  mydisp.setColor(random(254)+1);
  mydisp.print(pi, 6); //display PI in 6 Accuracy
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("Pi*3=");
  mydisp.setColor(random(254)+1);
  mydisp.print(pi * 3, 6); //display PI time 3 in 6 Accuracy
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print("lg5=");
  mydisp.setColor(random(254)+1);
  mydisp.print(log(5), 8); //display log(5) in 8 Accuracy
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.print(d); //display String object
  resetpos();
  for (uint8_t j = 0; j < 2; j++) //making "Hello" string moving
  {
    for (uint8_t i = 0; i < 10; i++) //move string to right
    {
      mydisp.setPrintPos(i, 1, _TEXT_);
      mydisp.setColor(random(254)+1);
      mydisp.print(" Hello ");
      delay(100); //delay 100ms
    }
    for (uint8_t i = 0; i < 10; i++) //move string to left
    {
      mydisp.setPrintPos(9 - i, 1, _TEXT_);
      mydisp.setColor(random(254)+1);
      mydisp.print(" Hello ");
      delay(100);
    }
  }
  mydisp.setColor(random(254)+1);
  mydisp.print("Enjoy it!");
  mydisp.enableCursor(); //enable cursor
  /*---------for Graphic LCD adapter only-------*/
  mydisp.disableCursor(); //enable cursor
  resetpos();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 1, "Negative/flash");
  mydisp.setMode('~');
  for (uint8_t i = 0; i < 10; i++) {
    mydisp.drawBox(0, 13, 110, 13);
    delay(500);
  }
  resetpos();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "Draw image in 4 dir");
  //display image in 4 different directions, use setRot90();setRot180();setRot270();undoRotation();setRotation(dir);
  for (uint8_t i = 0; i < 4; i++) {
    mydisp.setRotation(i);
    mydisp.setColor(random(254)+1);
    mydisp.drawBitmap(12, 12, 41, 21, welcomeimage);
  }
  mydisp.undoRotation();
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw a box");
  mydisp.setColor(random(254)+1);
  mydisp.drawBox((SC_W-30)/2, SC_H/2, 30, 40);
  //test drawing a circle
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw a circle and a pie");
  mydisp.setColor(random(254)+1);
  mydisp.drawCircle(31, 31, 30);
  mydisp.setColor(random(254)+1);
  mydisp.drawCircle(31, 31, 14, 1);
  //test drawing a Frame
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw a Frame");
  mydisp.setColor(random(254)+1);
  mydisp.drawFrame(20, 15, SC_W/2, SC_H/2);
  //Clear an area use set color =0
  resetpos1();
  mydisp.clearScreen();
  mydisp.drawStr(0, 0, "Clear an area by using set color=0");
  mydisp.setColor(random(254)+1);
  mydisp.drawCircle(35, 70, 35, 1);
  mydisp.setColor(random(254)+1);
  mydisp.drawBox(80, 40, 80, 60);
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
  mydisp.setColor(0);
  mydisp.drawCircle(110, 70, 25, 1);
  mydisp.drawBox(20, 50, 40, 30);
  //test drawing Pixels
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw Pixels");
  for (uint8_t i = 0; i < 20; i++) {
    mydisp.setColor(random(254)+1);
    mydisp.drawPixel(random(SC_W-1), 12 + random(SC_H-13));
  }
  //test drawing Lines
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw Lines");
  for (uint8_t i = 0; i < 10; i++) {
    mydisp.setColor(random(254)+1);
    mydisp.drawLine(random(SC_W-1), 12 + random(SC_H-13), random(SC_W-1), 12 + random(SC_H-13));
  }
  //test drawing Lines to
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "draw Lines to");
  mydisp.setColor(random(254)+1);
  mydisp.drawLine(random(SC_W-1), 12 + random(SC_H-13), random(SC_W-1), 12 + random(SC_H-13));
  for (uint8_t i = 0; i < 10; i++) {
    mydisp.setColor(random(254)+1);
    mydisp.drawLineTo(random(SC_W-1), 12 + random(SC_H-13));
  }
  //test differnt font
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "default font");
  mydisp.setFont(fonts[0]);
  mydisp.nextTextLine();
  mydisp.setColor(random(254)+1);
  mydisp.print("Font 6");
  mydisp.setFont(fonts[1]);
  mydisp.nextTextLine();
  mydisp.setColor(random(254)+1);
  mydisp.print("Font 10");
  mydisp.setFont(fonts[2]);
  mydisp.nextTextLine();
  mydisp.setColor(random(254)+1);
  mydisp.print("Font 18");
  mydisp.setFont(fonts[3]);
  mydisp.nextTextLine();
  mydisp.setColor(random(254)+1);
  mydisp.print("Font 51");
  resetpos1();
  mydisp.clearScreen();
  mydisp.setFont(fonts[4]);
  mydisp.setPrintPos(0, 0, _TEXT_);
  mydisp.setColor(random(254)+1);
  mydisp.print("Font 120");
  mydisp.setFont(fonts[5]); //font 123 only have chars of space and 1 to 9
  mydisp.setColor(random(254)+1);
  mydisp.nextTextLine();
  mydisp.print("123");
  resetpos1();
  mydisp.clearScreen();
  //User font using number: 200,201,202,203,only available after upload to adapter
  mydisp.setFont(10);
  mydisp.setColor(random(254)+1);
  mydisp.drawStr(0, 0, "User font using:200,201,202,203,available after upload to adapter,16Kb space.");
  //move area on screen
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.print("move area on screen");
  mydisp.setColor(random(254)+1);
  mydisp.drawCircle(31, 31, 14, 1);
  delay(2000);
  mydisp.moveArea(31, 31, 15, 15, 5, 8);
  //set display mode, affect all graphic functions, the available mode: "|"-or,"&"-and,"^"-xor,"!"-not,"C"-copy
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.print("use xor or not mode to show a Circle Animation");
  mydisp.setMode('^');
  for (uint8_t i = 1; i < 31; i++) {
    mydisp.setColor(random(254)+1);
    mydisp.drawCircle(31, 31, i); //draw a circle
    delay(50);
    mydisp.drawCircle(31, 31, i); //disappear the previos draw
  }
  //this section show how to use enhanced TEXT position functions:
  //setTextPosBack(),setTextPosOffset() and setTextPosAbs() to make some thing fun
  resetpos1();
  mydisp.clearScreen();
  mydisp.setMode('|');
  mydisp.setColor(random(254)+1);
  mydisp.print("Bold D");
  mydisp.setFont(120);
  mydisp.nextTextLine();
  mydisp.setColor(random(254)+1);
  mydisp.print('D');
  mydisp.setTextPosBack(); //set text position back
  delay(2000);
  mydisp.setTextPosOffset(2, 0); //move text position to x+2
  mydisp.setColor(random(254)+1);
  mydisp.print('D'); //display D again, under or mode, it will bold 'D'
  //use setTextPosAbs() to make a Animation letter
  resetpos1();
  mydisp.clearScreen();
  mydisp.setColor(random(254)+1);
  mydisp.print("make > animation");
  mydisp.setFont(51);
  mydisp.setMode('C');
  for (uint8_t i = 0; i < SC_W-20; i++) {
    mydisp.setTextPosAbs(i, 45);
    mydisp.setColor(random(254)+1);
    mydisp.print('>');
    delay(5);
  }
  //show font in different direction
  resetpos1();
  mydisp.clearScreen();
  mydisp.setFont(fonts[1]);
  mydisp.setColor(random(254)+1);
  mydisp.print("show font in different direction");
  resetpos1();
  mydisp.clearScreen();
  for (uint8_t i = 0; i < 4; i++) {
    mydisp.setRotation(i);
    mydisp.setFont(fonts[2]);
    mydisp.setPrintPos(0, 0);
    for (uint8_t j = 0; j < 3; j++) {
      mydisp.setFont(fonts[2 - j]);
      if (j != 0)
        mydisp.nextTextLine();
      mydisp.setColor(random(254)+1);
      mydisp.print(fontdir[i]);
    }
  }
  resetpos1();
  mydisp.clearScreen();
  mydisp.setMode('C'); //set graphic Drawing Mode to COPY
  mydisp.setColor(random(254)+1);
  mydisp.drawHLine(0, SC_H/2-1, SC_W-1); //draw horizontal LiNe
  mydisp.setColor(random(254)+1);
  mydisp.setPrintPos(0, SC_H/2-1, 1); //Set Graphic position
  for (int i = 1; i <= SC_W-1; i = i + 6) //this loop will draw sin graph
  {
    mydisp.setColor(random(254)+1);
    mydisp.drawLineTo(i, (SC_H/2 - (float) (sin(i * 3.14 / (SC_W/2-1))*(SC_H/2))));
  }
}

void loop() {
}

Cheers
 
Moving on

So, that's me running two Digole trough SPI. CS pins are 2 and 3. The speed is enough for what I am willing to do. The graphic is kind of ugly but that is not the point here.

If I increase the number of displays I will lost significantly in speed?

I had a really hard time learning the weird behavior of the graphic commands. When the ILI9340's arrives I wish that the library will be more easy to handle.

I hope that you guys still with me...

Here is the video:

http://sendvid.com/o8nuu589


Here is my Code:
Code:
#include <Wire.h> //I don't know why I have to include this, but without it won't compile


#define _Digole_Serial_SPI_  //To tell compiler compile the special communication only, 
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>

//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp1(11,13,2);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
DigoleSerialDisp mydisp2(11,13,3);
#endif
#define SC_W 176  //screen width in pixels
#define SC_H 220  //screen Hight in pixels

void setup() {
  mydisp1.begin();
  mydisp1.clearScreen(); //CLear screen
  mydisp1.setBackLight(70);
  
  

  mydisp2.begin();
  mydisp2.clearScreen(); //CLear screen
  mydisp2.setBackLight(70);
}

void loop() {

mydisp1.clearScreen();

mydisp1.setDrawWindow(0, 0, 176, 220);
mydisp1.setColor(50);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setRotation(45);
mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,2);
mydisp1.print("  CHORUS");

mydisp2.clearScreen();

mydisp2.setDrawWindow(0, 0, 176, 220);
mydisp2.setColor(255255000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setRotation(45);
mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(5,2);
mydisp2.print("OVERDRIVE");

//mydisp2.clearScreen();

delay(5000);

mydisp1.setRotation(45);
mydisp1.setDrawWindow(15, 15, 190, 150);
mydisp1.setColor(255000000);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,1);
mydisp1.print(" CHORUS ");

mydisp2.setRotation(45);
mydisp2.setDrawWindow(15, 15, 190, 150);
mydisp2.setColor(255000000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(2,1);
mydisp2.print(" OVERDRIVE ");

delay(5000);
mydisp1.setColor(000000000);
mydisp1.setBgColor();

mydisp2.setColor(000000000);
mydisp2.setBgColor();



}

Thank you!
Cheers
 
I don't know if you guys still interested, but I am progressing on this thing! Now I am driving 4 Displays with two distinct libraries, the Digole.h and ILI9341_AS that I found online and was the only one that works with my displays above 16Mhz. (I am at 76Mhz because the Digole wont work @96Mhz).

Here is what I am doing:
https://youtu.be/JkvOP5y40uE

Here is my code:
Code:
#include <SPI.h>

#include <Wire.h>

/*
 An example showing rainbow colours on a 2.2" TFT LCD screen
 and to show a basic example of font use.
 
 The existing Adafruit font is still in the library
 Only new font sizes 2,4,6 and 7 are implemented in the Adafruit_GFX_AS library.
 
 This examples uses the hardware SPI only. Non-hardware SPI
 is just too slow (~8 times slower!)
 
 Alan Senior 18/1/2015

 */

// These are the connections for the UNO
#define sclk 13  // Don't change
#define mosi 11  // Don't change

#define tft1_cs 3
#define tft1_dc 4
#define tft1_rst 9

#define tft2_cs 5
#define tft2_dc 6
#define tft2_rst 10


#include <Adafruit_GFX_AS.h>    // Core graphics library
#include <Adafruit_ILI9341_AS.h> // Hardware-specific library


#define _Digole_Serial_SPI_  //To tell compiler compile the special communication only, 
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>

//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp1(7,14,20);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
DigoleSerialDisp mydisp2(7,14,2);
#endif
#define SC_W 176  //screen width in pixels
#define SC_H 220  //screen Hight in pixels

// Color definitions
#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0  
#define WHITE   0xFFFF

Adafruit_ILI9341_AS tft1 = Adafruit_ILI9341_AS(tft1_cs, tft1_dc, tft1_rst); // Invoke custom library
Adafruit_ILI9341_AS tft2 = Adafruit_ILI9341_AS(tft2_cs, tft2_dc, tft2_rst);


void setup(void) {
  
  mydisp1.begin();
  mydisp1.clearScreen(); //CLear screen
  mydisp1.setBackLight(50);
  

  mydisp2.begin();
  mydisp2.clearScreen(); //CLear screen
  mydisp2.setBackLight(50);
   //delay(500);
  tft1.init();
  tft1.setRotation(2);
  tft1.fillScreen(ILI9341_BLACK);


  tft2.init();
  tft2.setRotation(2);
  tft2.fillScreen(ILI9341_BLACK);
  

  delay(1000);


}

void loop() {

  tft1.setCursor(30, 70);
  tft1.setRotation(45);
  tft1.fillScreen(BLUE);
  tft1.setTextColor(WHITE);
  tft1.setTextSize(9);
  tft1.println("Hallo");

  //delay(10);
  
  tft2.setCursor(30, 70);
  tft2.setRotation(45);
  tft2.fillScreen(GREEN);
  tft2.setTextColor(BLUE);
  tft2.setTextSize(9);
  tft2.println("OI");


mydisp1.setColor(000000000);
mydisp1.setBgColor();

mydisp2.setColor(000000000);
mydisp2.setBgColor();



mydisp1.clearScreen();

mydisp1.setDrawWindow(0, 0, 176, 220);
mydisp1.setColor(50);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setRotation(45);
mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,2);
mydisp1.print("  CHORUS");

mydisp2.clearScreen();

mydisp2.setDrawWindow(0, 0, 176, 220);
mydisp2.setColor(255255000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setRotation(45);
mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(5,2);
mydisp2.print("OVERDRIVE");

  delay(3000);

  tft1.fillRect(20, 30, 300, 200, GREEN);
  tft1.setCursor(30, 70);
  tft1.println("Hallo");

  //delay(10);

  tft2.fillRect(20, 30, 300, 200, RED);
  tft2.setCursor(30, 70);
  tft2.println("OI");

mydisp1.setRotation(45);
mydisp1.setDrawWindow(15, 15, 190, 150);
mydisp1.setColor(255000000);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,1);
mydisp1.print(" CHORUS ");

mydisp2.setRotation(45);
mydisp2.setDrawWindow(15, 15, 190, 150);
mydisp2.setColor(255000000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(2,1);
mydisp2.print(" OVERDRIVE ");

delay(5000);

}

Cheers
 
Sorry, sixeight! I didn't noticed that nobody could see... Now I changed!

Glad that you toke a look! I am following your progress on the vguitar forum!
 
I ordered first only those to make tests. I am using for CS and DC not the dedicated pins, so I am confident that could work.
The Digole display I would almost assume that they would work because they are pretty quick and have a chip that need only 3(!) Wires (data, clock and ss). But the Digole is is around 12$ and the ili9341 5$... so I will try to do it with the cheap one. I will order the 6 displays left.
 
Status
Not open for further replies.
Back
Top