Hm also ich bin jetzt so weit, das ich heraus gefunden habe, dass wenn ich das display immer neu initialisiere, nachdem ich es voll geschreiben habe (2x16 Zeichen), dann kann ich meist so viel aus geben wie ich will.
Es scheint als ob das Display waerend es befehle bekommt "abstuertzt".
Wenn Text einmal ausgeben ist, dann ist alles ok und der Verschwindet auch nicht wider oder so.
Wie gesagt ich kann das Display durch erneute initialisierung wider zurueck holen. Das klappt aber auch nur in 4 von 5 faellen (circa).
Da das Display nicht einfach so ausgeht, muss es irgent wie an der kommunikation liegen. Da es keinen uebertragungsfehler gibt (alle Zeichen die ausgeben werde sind richtig) und wenn es einmal initalisiert is auch nicht zwischen drinn abbricht, gehe ich davon aus, dass mein Programm irgend was falsch macht... aber was??
wenn ich ohne erneute initialisirung weiteren text aus gebe (natuerlich nach vorherigem CLS (0x01) oder DDRAM Address set (0x80) und einem delay danach, "stuertzt" das Display ab..Code:/***********************************************************************/ /* */ /* FILE :FirstTest.c */ /* DESCRIPTION :Main Program */ /* CPU TYPE :Other */ /* */ /* This file is generated by Renesas Project Generator (Ver.4.0). */ /* */ /***********************************************************************/ #include "sfr_r813.h" /*************************************************************************************/ /* Output/Input definitions */ /*************************************************************************************/ /* p1_0 = DB0 p1_1 = DB1 p1_2 = DB2 p1_3 = DB3 p1_4 = DB4 p1_5 = DB5 p1_6 = DB6 p1_7 = DB7 */ #define LCDPORT p1 #define Enable p3_1 #define R_W p0_1 #define RS p3_7 /**************** delay ************/ void delay(long zeit) /* 2000 ist ca. 5 msec */ { /* 50 ist ca. 150 usec */ /* 50000 ist ca. 120 msec */ long t = 0; for (t=0; t<zeit; t++) {} } /*************************************************************************************/ /* Funktion Wait_ms */ /*************************************************************************************/ Wait_ms(long y) { long z; y = y * 520; /* Wert für ms Zählschleife bei 20MHz */ for(z=0;z<y;z++) { asm("nop"); } } /*************************************************************************************/ /* Funktion Wait_us */ /*************************************************************************************/ Wait_us(long y) { long z; y = y * 2; /* Wert für us Zählschleife bei 20MHz */ for(z=0;z<y;z++) { asm("nop"); } } /**************** Instruction ************/ void inst(int anw) { RS = 0; LCDPORT=anw; Enable = 1; Wait_us(30); Enable = 0; Wait_us(30); } /**************** Data ************/ void data(int wert) { RS = 1; LCDPORT=wert; Enable = 1; Wait_us(30); Enable = 0; Wait_us(30); RS = 0; } /********** Display einstellen ************/ void init(void) { Enable = 0; R_W = 0; RS = 0; LCDPORT = 0x0; /*Port1 = low*/ Wait_ms(60); /*Wait 60 ms*/ inst(0x39); // Funktionset 8-bit, 2 lines, Instruction Table 1 inst(0x39); //secondtime inst(0x39); inst(0x39); inst(0x1c); //Bias 1/4, 2-zeilen LCD inst(0x52); //Booster aus, Kontras C5 und C4 inst(0x69); //Spannungsfolger und Verstärkung setzten Wait_ms(300); inst(0x74); //Kontras C3,C2,C1 inst(0x38); //back to instruction table 0 inst(0x0f); //Display ein, Cursor ein, Cursor blinken inst(0x01); //Display löschen, Cursor Home inst(0x06); //Cursor Auto-Increment LCDPORT = 0x0; /*Port1 = low*/ //Wait_ms(2000); /*Wait 60 ms*/ } /********** Daten ausgeben ************/ void ausgabe( char ausgabewert[16]) { int i = 0; //data(sizeof(ausgabewert)); for (i=0;i<16;i++) { data(ausgabewert[i]); } } /*************************************************************************************/ /* Funktion LCD_Write_Integer */ /*************************************************************************************/ void LCD_Write_Integer(unsigned int a) { unsigned char idx; /*Schleifenzähler*/ /*unsigned int a = 10234;*/ /*Beispielzahl die dargestellt werden soll*/ unsigned int div = 1000; /*Teilen bei int max 10000*/ unsigned int buff; /*Temp*/ unsigned char flag = 0; /*Flag wird für Nullunterdrückung benötigt*/ unsigned char Aus =0; /*Ausgabe wird an LCD-Display übergeben*/ for(idx=0;idx<4;idx++) /*Schleife 5* für 10000er Stelle*/ { buff = a; buff = buff / div; if(flag == 0) { if(buff >0) { flag = 1; } } Aus = buff + 48; /*Umrechnung für LCD-Display*/ if(flag == 0) { Aus = 254; /*Nullunterdrückung durch Leerzeichen*/ } if(flag == 0 && idx == 3) { Aus = 48; /*bei Zahl null, eine null darstellen*/ } data(Aus); a = a - (buff * div); div = div/10; } } void setOutPuts(void) { p0 = 0x00; p1 = 0x00; p3_1 = 0x00; p3_7 = 0x00; } void main(void) { /*------------------------------------------------- - Change on-chip oscillator clock to Main clock - -------------------------------------------------*/ unsigned int g = 0; Wait_ms(1); prc0 = 1; /* Protect off */ cm13 = 1; /* Xin Xout */ cm15 = 1; /* XCIN-XCOUT drive capacity select bit : HIGH */ cm05 = 0; /* Xin on */ cm16 = 0; /* Main clock = No division mode */ cm17 = 0; cm06 = 0; /* CM16 and CM17 enable */ asm("nop"); /* Waiting for stable of oscillation */ asm("nop"); asm("nop"); asm("nop"); ocd2 = 0; /* Main clock change */ prc0 = 0; /* Protect on */ Wait_ms(3000); prc2 = 1; /* !!! Port 0 protection aufheben !!! */ //adcon1 = 0x00; //Deactivate A/D Resitorladder pd0 = 0xFF; //set P0 to output mode p0 = 0x00; //set P0 to low //drr = 0xff; //P1 LED Drive capabiity //pur0 = 0x00; //pur1 = 0x00; //txmr = 0x00; //tc = 0x0000; pd1 = 0xFF; /* Set Port 1.0 - 1.3 be used for output*/ pd3 = 0x0F; /* SET PORT 3.0 - 3.? ALS OUTPUT */ pd3_7 = 0x01; /enable output mode p0_4 = 1; //LED p0_5 = 0; //LED p0_6 = 0; //LED Wait_ms(300); init(); /* Display einstellen */ Wait_ms(3000); ausgabe("Enableling COMs."); inst(0xC0); Wait_us(30); ausgabe("EA DOGM162 2x16c"); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("Setting Online S"); inst(0xC0); Wait_us(30); ausgabe("Trace..........."); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("InitialatingSys0"); inst(0xC0); Wait_us(30); ausgabe("Loading Nitro..."); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("InitialatingSys1"); inst(0xC0); Wait_us(30); ausgabe("LoadingBassboost"); Wait_ms(3000);inst(0x80); init(); Wait_ms(300); Wait_us(30); ausgabe("InitialatingSys2"); inst(0xC0); Wait_us(30); ausgabe("Loading Speed..."); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("InitialatingSys3"); inst(0xC0); Wait_us(30); ausgabe("Loading Space..."); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("InitialatingSys4"); inst(0xC0); Wait_us(30); ausgabe("Loading Fun....."); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("InitialatingSys5"); inst(0xC0); Wait_us(30); ausgabe("LoadingAdrenalin"); Wait_ms(3000); init(); Wait_ms(300); inst(0x80); Wait_us(30); ausgabe("NFS DRIVER READY"); inst(0xC0); Wait_us(30); ausgabe("PRESS SPEED TO S"); Wait_ms(3000); while(1) {} }







Zitieren

Lesezeichen