mega with toshiba T6963 display

Hi can anyone help me, i just got this display and managed to get most of my code to work,but in my loop function my display keeps switching between my readings ,can any one please point me in the write direction I used U8glib,h and got all the examples to work proberly,and then used bits and pieces from each code example and got so far but now im stuck any help will be app. the aim in the loop is read button state and dispay if it is on ie OK, or off, Failed

. Thank you

can not attach file can seem to the system to attach my file and its more than 9000 char!

#include "U8glib.h"
U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16

const int buttonPin1 = A0;
const int buttonPin2 = A1;
const int buttonPin3 = A2;
const int buttonPin4 = A3;
const int buttonPin5 = A4;
const int buttonPin6 = A5;

int buttonState = 0;




//#define MINI_LOGO

void drawColorBox(void)
{
  u8g_uint_t w,h;
  u8g_uint_t r, g, b;
  
  w = u8g.getWidth()/32;
  h = u8g.getHeight()/8;
  for( b = 0; b < 4; b++ )
    for( g = 0; g < 8; g++ )
      for( r = 0; r < 8; r++ )
      {
        u8g.setColorIndex((r<<5) |  (g<<2) | b );
        u8g.drawBox(g*w + b*w*8, r*h, w, h);
      }
}

void drawLogo(uint8_t d)
{
#ifdef MINI_LOGO
   u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(0+d, 30+d, "S");
    
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(15+d,30+d,"u");

     u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(30+d,30+d,"p");
    
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(42+d,30+d,"a");

    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(60+d,30+d,"F");

    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(82+d,30+d,"u");

    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(95+d,30+d,"e");

    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(107+d,30+d,"l");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(0+d,60+d,"(");

     u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(10+d,60+d,"P");

     u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(25+d,60+d,"t");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(40+d,60+d,"y");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(55+d,60+d,"(");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(70+d,60+d,"L");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(85+d,60+d,"t");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(100+d,60+d,"d");

    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(115+d,60+d,")");

    
    
    u8g.drawHLine(4+d, 35+d, 200);
    u8g.drawVLine(32+d, 22+d, 12);

    
#else
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(0+d, 30+d, "S");
    delay(150);
    
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(19+d,30+d,"u");
delay(150);
     u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(31+d,30+d,"p");
   delay(150); 
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(45+d,30+d,"a");
delay(150);
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(65+d,30+d,"F");
delay(150);
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(82+d,30+d,"u");
delay(150);
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(95+d,30+d,"e");
delay(150);
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(107+d,30+d,"l");
delay(150);
    u8g.setFont(u8g_font_gdr30r);
    u8g.drawStr(165+d, 50+d, "|");
delay(150);
     u8g.setFont(u8g_font_gdr30r);
     u8g.drawStr(170+d, 55+d, "_");
delay(150);
     u8g.setFont(u8g_font_gdr30r);
     u8g.drawStr(165+d, 2+d, "|");
delay(150);
      u8g.setFont(u8g_font_gdr30r);
     u8g.drawStr(175+d, 55+d, "_");
delay(150);
       u8g.setFont(u8g_font_gdr30r);
      u8g.drawStr(185+d, 55+d, "_");
delay(150);
       u8g.setFont(u8g_font_gdr30r);
     u8g.drawStr(195+d, 55+d, "_");
delay(150);
      u8g.setFont(u8g_font_gdr30r);
     u8g.drawStr(205+d, 55+d, "_");

 delay(150);     

 u8g.setFont(u8g_font_gdr30r);
    u8g.drawStr(175+d, 40+d, "S");
delay(150);

  u8g.setFont(u8g_font_gdr30r);
    u8g.drawStr(200+d, 55+d, "f");  
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(0+d,60+d,"(");
delay(150);
     u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(10+d,60+d,"P");
delay(150);
     u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(25+d,60+d,"t");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(40+d,60+d,"y");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(55+d,60+d,")");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(70+d,60+d,"(");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(85+d,60+d,"L");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(100+d,60+d,"t");
delay(150);
    u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(115+d,60+d,"d");
delay(150);
     u8g.setFont(u8g_font_gdr10r);
    u8g.drawStr(130+d,60+d,")");

 delay(150);  

   u8g.drawHLine(4+d, 35+d, 110);
   // u8g.drawVLine(60+d, 32+d, 12);
#endif
}

part2

//void drawURL(void)
//{
//#ifndef MINI_LOGO
 // u8g.setFont(u8g_font_4x6);
//  if ( u8g.getHeight() < 59 )
//  {
 //   u8g.drawStr(58,18,"Automatic Water Removal System");
 //   u8g.drawStr(77,18,"!! V1.0");
 // }
  //else
 // {
 //   u8g.drawStr(1,54,"Automatic Water Removal System");
 // }
//#endif
//}


void draw(void) {
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    drawColorBox();
  }
  u8g.setColorIndex(1);
  if ( U8G_MODE_GET_BITS_PER_PIXEL(u8g.getMode()) > 1 ) {
    drawLogo(2);
    u8g.setColorIndex(2);
    drawLogo(1);
    u8g.setColorIndex(3);
  }
  drawLogo(0);
//  drawURL();
  
}

void draw1() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20); 
  u8g.print("System Diagnostics Mode");
}
//****************************s1 test***************************************************************
void draw2() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print(" Cheecking V1 ......S1");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S1 = Passed !! ");
}

 void draw3() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print("  Cheecking V1 ......S1");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S1 = Failed !! "); 
  
}


//****************************s2 test***************************************************************
void draw4() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print(" Cheecking V1 ......S2");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S2 = Passed !! ");
}

 void draw5() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print("  Cheecking V1 ......S2");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S2 = Failed !! "); 
  
}

//****************************s3 test***************************************************************
void draw6() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print(" Cheecking V2 ......S1");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V2....S1 = Passed !! ");
}

 void draw7() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print("  Cheecking V2 ......S1");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S2 = Passed !! "); 
  
}

//*********************************TEST 4****************************************************************
 void draw8() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print("  Cheecking V2 ......S1");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S2 = Passed "); 
  
}


 void draw9() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 40); 
  u8g.print("  Cheecking V2 ......S2");
  
  u8g.setPrintPos(0, 60); 
  u8g.print(" V1....S2 = Failed !!! "); 
  
}

//*********************************Loop testingS1*********************************************************

void draw10() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(120, 10); 
  u8g.print("V1/S1 =");
u8g.setPrintPos(120, 10); 
  u8g.print("V1/S2 =");
  
}

//**************************************LOOPTEST S2*********************************************************  
  
void draw11() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(80, 10); 
  u8g.print("OK");
}
void draw12() {
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(200, 10); 
  u8g.print("FAIL");


}
 

  

void setup(void) {
 pinMode(buttonPin1, INPUT); 
pinMode(buttonPin2, INPUT);
 u8g.firstPage();  
  do {
    draw();
  u8g.setColorIndex(1);
  } while( u8g.nextPage() );
delay(2000);

 u8g.firstPage();
 do {
    draw1();
 } while( u8g.nextPage() );
delay(1000);

//*********************************s1 test mode*****************************************************
 u8g.firstPage();
  
    
do{
    buttonState = digitalRead(buttonPin1);
    if (buttonState == HIGH)
   draw2();
   else {
   draw3();
  }  
  }while         ( u8g.nextPage());

delay(2000);
//*****************************s2 test mode************************************************************
u8g.firstPage();
  
    
do{
    buttonState = digitalRead(buttonPin2);
    if (buttonState == HIGH)
   draw4();
   else {
   draw5();
  }  
  }while         ( u8g.nextPage());

delay(2000);

//*****************************s3 test mode************************************************************
u8g.firstPage();
  
    
do{
    buttonState = digitalRead(buttonPin3);
    if (buttonState == HIGH)
   draw6();
   else {
   draw7();
  }  
  }while         ( u8g.nextPage());

delay(2000);

//*****************************s4 test mode************************************************************
u8g.firstPage();
  
    
do{
    buttonState = digitalRead(buttonPin4);
    if (buttonState == HIGH)
   draw8();
   else {
   draw9();
  }  
  }while         ( u8g.nextPage());

delay(1000);




}



void loop(void) {
  
 u8g.firstPage();
  
    
do{
   // buttonState = digitalRead(buttonPin1);
   // if (buttonState == HIGH)
   draw10();
 
  }while         ( u8g.nextPage());

//********************************S2**************************************
u8g.firstPage();
  
    

    buttonState = digitalRead(buttonPin2);
    if (buttonState == HIGH)
    
   draw11();
   else {
   draw12();
}  
  while       ( u8g.nextPage());

    
 delay(100);


  
}

ok, u8glib works differently. I know, many people did complain about this, but it will save a lot of RAM and your display will not have any flicker.

I just went through your code, but there are some principles you MUST follow with U8glib: Within the body of the picture loop

    u8g.firstPage();
    do  {
      draw();
    } while( u8g.nextPage() );

Do not check for any buttons, do not use delay(), do not change graphics.

Please also read this: https://github.com/olikraus/u8glib/wiki/tpictureloop

Start with small programs, like the hello world. Continue to more complex programms like the Menu or the Chess example. Have a look at the bottoms of these examples. The picture loop is always the same and keys are processed outside of that loop (although the keys itself are checked and queued inside...)

Let me know if you have further questions.

Oliver

Thanks I give it a try today and let you know

Thank you

Hi Oliver, i have played around a bit and can get the examples to work 100 percent but trying to get my code to work is bugguing me, i searched the web site a nd ardunio codec and found a T6963 libary which i found on the arduio display play ground, seem to be a bit easier to understand but it does not compile,i get the listed faulds as below the code, have you used this libary before? any help would be app. thanks

#include "T6963.h"
#include "gfxdata.h"
#include "Times_New_Roman__14.h"

T6963 LCD(240,64,6,32);// 240x64 Pixel and 6x8 Font


 PROGMEM prog_uchar* animdemo[] = 	   // Flash Images for Animation 24 Frames 
{   
  IMG01bmp,IMG02bmp,IMG03bmp,IMG04bmp,IMG05bmp,IMG06bmp,IMG07bmp,IMG08bmp,IMG09bmp,IMG10bmp,IMG11bmp,IMG12bmp,IMG13bmp,IMG14bmp,IMG15bmp,IMG16bmp,IMG17bmp,
  IMG18bmp,IMG19bmp,IMG20bmp,IMG21bmp,IMG22bmp,IMG23bmp,IMG24bmp  
};

char textmode[] = { '0','5','8','D'};
char* textmessage[] = { "           * Normal Display *           ", "          * Reverse Display *          ", "      * Blink of normal Display *      ", "      * Blink of reverse Display *      "};
int pcount;

void setup(){
  Serial.begin(9600);
  Serial.print("TH: ");
  Serial.println(LCD.getTH());
  Serial.print("GH: ");
  Serial.println(LCD.getGH());
  
  LCD.Initialize();
  
  Serial.println("Initialized");
  
  
}
void loop(){
  
  for(byte _b = 0;_b<240;_b++){
    LCD.writePixel(_b,_b>>1,1);
  }
  for(byte _b=0;_b<64;_b +=8){
    LCD.TextGoTo(_b/8,_b/8);
    LCD.writeString("Hello World");
  }
  delay(1000);
  LCD.clearGraphic();
  LCD.createLine(0,0,239,63,1);
  delay(1000);
  LCD.createLine(239,0,0,63,1);
  LCD.clearGraphic();
  delay(500);
  LCD.clearText();
  LCD.setPixel(0,0);
  LCD.setPixel(239,0);
  LCD.setPixel(239,63);
  LCD.setPixel(0,63);
  delay(1000);
  for(int x=0;x<64;x+=4){
    LCD.createLine(0,x,x<<1,63,1);
    delay(50);
  }
  delay(1000);
  LCD.createCircle(80,24,16,1);
  LCD.createCircle(90,26,16,1);
  LCD.createCircle(100,28,16,1);
  LCD.createCircle(110,30,16,1);
  LCD.createCircle(120,32,16,1);
  LCD.createCircle(130,34,16,1);
  LCD.createCircle(140,36,16,1);
  LCD.createCircle(150,38,16,1);
  LCD.createCircle(160,40,16,1);
  delay(1000);
  LCD.clearGraphic();
  LCD.clearText();
 
 // Text Attribute Mode by T6963C
 
 //Set Text attributes in Text Mode,Graphic Off
 LCD.setMode('T','I');//0=Normal X=Xor A=And T=Text Attribute Mode  ,  I=Intern CGram ,E=Extern CGram
 
  for(int i = 0;i<4;i++)
  { 
  LCD.TextGoTo(0,0);
  LCD.writeString("TEXT DEMO Textattribute Set by T6963C");
  LCD.TextGoTo(0,2);
  LCD.writeString(textmessage[i]);
  LCD.setTextAttrMode(textmode[i]); // 0=Normal display 5=Reverse display 3=Inhibit display 8=Blink of normal display D=Blink of reverse display B=Blink of inhibit display (TEXT ONLY)
  
  for (int x = 0; x <= 126; x++)
      {
	LCD.TextGoTo(x,4);			
	LCD.writeChar(x+33);
        delay(100);
      }
  LCD.clearText();
  }
 LCD.setMode('0','I');//0=Normal X=Xor A=And T=Text Attribute Mode  ,  I=Intern CGram ,E=Extern CGram
 LCD.clearGraphic();

/* 
  LCD.setDispMode(true,true,true,false);
  for(byte _b=0;_b<8;_b++){
    for(byte _row = 0;_row < LCD.getTextRows();_row++){
      for(byte _col = 0;_col < LCD.getTextCols();_col++){
        LCD.setCursorPointer(_col,_row);
        delay(100);
      }
    }
    LCD.setCursorPattern(_b);
  }
  LCD.setDispMode(true,true,false,false);
*/


 // Filled Box Speed Demo  
   for(int i = 0;i<5;i++) 
{
   LCD.TextGoTo(0,0);
   LCD.writeString("       Speed Demo with filled Box       ");
   LCD.TextGoTo(1,7);   
   LCD.writeString("    write Byte         write Pixel");
   LCD.Rectangle(4,10,112,44,1);                            //Position Horizontal, Position Vertikal, Länge, Höhe des Rechteck
   LCD.drawrectbyte(10,12,40,18,0b111111);                  // drawrectbyte(x, y, height, bytewidth, pattern) // x,y = Start Position, Height in Pixel, Widht in Byte (6x8Font =6 Bits 8x8Font = 8 Bits, Fill pattern in byte Example:0b10101010  
   LCD.Rectangle(124,10,112,44,1);
   LCD.fillRect(126,12,233,51,1);                           //X,Y,X1,Y1
   delay(100);
   LCD.drawrectbyte(10,12,40,18,0b00000000);//Clear Box byte
   LCD.drawrectbyte(126,12,40,18,0b00000000);//Clear Box Pixel
}
  LCD.clearGraphic();
  LCD.clearText();

// Arduino Image 1 + 2
  LCD.drawPic( 72, 0, Arduinobmp ,ArduinoHEIGHT, ArduinoBYTEWIDTH );	//x,y = Position, Picturename (not Filename), Height in Pixel, Widht in Byte
  delay(3000);
  LCD.drawPic( 72, 0, Arduino1bmp ,Arduino1HEIGHT, Arduino1BYTEWIDTH );	//x,y = Position, Picturename (not Filename), Height in Pixel, Widht in Byte
  delay(3000);
  LCD.clearGraphic();
  
// Animated Image
  LCD.setMode('x','I'); //Mode Set for Reverse Text
  for(int i = 0;i<10;i++)
      {
      LCD.drawrectbyte(0,0,8,40,0b111111);                  // drawrectbyte(x, y, height, bytewidth,pattern) // x,y = Start Position, Height in Pixel, Widht in Byte (6x8Font =6 Pixel 8x8Font = 8 Pixel, Fill pattern in byte Example:0b10101010  
      LCD.TextGoTo(1,0);
      LCD.writeString("LCD GRAPHIC DISPLAY 240x64 with T6963C");
      LCD.drawAnim( 62, 15, animdemo, 24, pictureHEIGHT, pictureBYTEWIDTH);
  
      }  
  LCD.setMode('0','I');//Switch to Normal Mode
  LCD.clearGraphic();
  LCD.clearText();
  
  
  
   //Font Demo
   LCD.glcd_print1_P(3, 0, "Font Times New Roman14", &Times_New_Roman__14, 0);
   LCD.glcd_print1_P(60, 20, "Hello World", &Times_New_Roman__14, 0);
   LCD.glcd_print1_P(60, 40, "Hello World", &Times_New_Roman__14, 1);
   delay (4000);
   LCD.clearGraphic();

}

This is the out put

Arduino: 1.6.5 (Windows 8.1), Board: "Digispark (Default - 16.5mhz)"

In file included from T6963_for_240x64.pde:1:0:
C:\Program Files (x86)\Arduino\libraries\T6963_Lib/T6963.h:105:23: error: 'prog_char' has not been declared
  void WriteStringPgm(prog_char * str);
                      ^
C:\Program Files (x86)\Arduino\libraries\T6963_Lib/T6963.h:127:44: error: 'prog_uchar' has not been declared
  void drawPic(unsigned int, unsigned int, prog_uchar *, unsigned int, unsigned int);
                                           ^
C:\Program Files (x86)\Arduino\libraries\T6963_Lib/T6963.h:128:45: error: 'prog_uchar' has not been declared
  void drawAnim(unsigned int, unsigned int, prog_uchar**, int, unsigned int, unsigned int);
                                            ^
In file included from T6963_for_240x64.pde:2:0:
C:\Program Files (x86)\Arduino\libraries\T6963_Lib/gfxdata.h:32:8: error: 'prog_uchar' does not name a type
extern prog_uchar IMG01bmp[]; //AVR-GCC, WinAVR
       ^
C:\Program Files (x86)\Arduino\libraries\T6963_Lib/gfxdata.h:33:8: error: 'prog_uchar' does not name a type
extern prog_uchar IMG02bmp[]; //AVR-GCC, WinAVR
       ^

[code]

Hi

I added T6963 support to u8glib exactly because i never managed to run any other existing T6963 library.

Oliver

Hi Oliver I just the site where you made the changes to C and cpp files im busy reading through this now, You perhaps still have an updated zip fill for this T6963 libary

Thanks

I do not remember, that i made any change to any other T6963 library.

Oliver