Kommentar: Einfügen von HTML im Kommentar: Link einfügen: <a href="LINKURL" target="_blank">LINKTITEL</a> Bild einfügen: <img src="BILDURL"> Text formatieren: <b>fetter Text</b> <i>kursiver Text</i> <u>unterstrichener Text</u> Kombinationen sind auch möglich z.B.: <b><i>fetter & kursiver Text</i></b> C Quellcode formatieren: <code>Quellcode</code> BASIC Quellcode formatieren: <basic>Quellcode</basic> (Innerhalb eines Quellcodeabschnitts ist kein html möglich.) Wichtig: Bitte mache Zeilenumbrüche, bevor Du am rechten Rand des Eingabefeldes ankommst ! -> I > > > > > Hallo Forum! > > > > > Ich habe am Projectboard mit Mega128 ein externes LCD mit 4x16 Zeichen angeschlossen und > > > > > nutze das Beispielprogramm dazu von Ulli Sommer im Ordner LCD. > > > > > Momentan habe ich beide IDEs, 2.13.0.15 und die neue 2.31.0.89 installiert. > > > > > Wenn ich das Programm mit der der alten IDE kompiliere funktioniert alles und es kommt zu > > > > > einer Anzeige am Display. Wenn ich aber mit der neuen IDE kompiliere, bleibt das Display leer. > > > > > Das Programm lässt sich auch mit der neuen IDE 2.31.0.89 ohne Fehler kompilieren, mit USB > > > > > oder seriell übertragen und starten. > > > > > Nur nach dem Programmstart bleibt das Display leer. > > > > > > > > Was kann das sein? > > > > > Vielleicht kann mir jemand dazu was sagen? > > > > > > > > > > für eine Antwort würde ich mich freuen. > > > > > Noch eine Bitte: Man sollte das Projektboard auch als Auswahl zu einem neuen Beitrag > > > > > auswählen können. > > > > > > > > > > > > > joga > > > > Hmm. Mein Gedankenlesermodul ist gerade kaputt, bitte erzähl doch die Details. > > Wie schließt Du das Modul an, SPI oder I2C? Welches Programm von Ulli Sommer > > meinst Du genau? > > > > Gruss Peter > > > Hallo Peter, > vielen Dank für die Rückmeldung. > Ich benutze das Projektboard mit Mega 128 und ein LCD 4x16 Zeichen HD44780 kompatibel. > Es ist so wie im Programm deklariert, angeschlossen (kein I2C Display). > Nur wenn ich das Programm mit der alte IDE kompiliere kann ich es starten und es kommt > zur gewünschten Anzeige, nur bei der neuen geht es nicht. > > Hier das Programm etwas abgeändert, aber das ist nicht der Fehler. > > 'Ein externes LCD über frei definierbare I/O Port ansprechen > 'z.B. 4x16 Zeichen Display Conrad-Bestellnummer: 183334 > 'Ausgabe von ASCII, Word und Float Variablen > > '------------------------------------------------------------------------------- > 'Programm Info > 'Das LCD kann an beliebige I/O Port des Controllers Mega32 oder > 'Mega128 angeschlossen werden. > 'Der Display-Controller muss HD44780 o. KS0066 Kompatibel sein. > 'Im Beispiel werden bei der Mega32 folgenden Pins verwendet: > ' > 'PortC.2 = RS > 'PortC.3 = E > 'PortC.4 = Datenport LCD D.4 > 'PortC.5 = Datenport LCD D.5 > 'PortC.6 = Datenport LCD D.6 > 'PortC.7 = Datenport LCD D.7 > ' > 'RW liegt auf Masse! Wird nicht benötigt, da wir nur auf das LCD schreiben > '------------------------------------------------------------------------------- > > Dim Text(22) As Char > Dim Text_Out As Char > > Dim Cnt As Integer > Dim Cnt_Float As Single > Dim ADC_1 As Word > Dim UB As Single > > Dim High_Nibble As Byte > Dim Low_Nibble As Byte > > 'LCD Pins definieren (frei wählbar) > #define Enable 19 > #define RS 18 > #define D4 20 > #define D5 21 > #define D6 22 > #define D7 23 > > #define Ref 0.004887 > > 'Hauptprogramm > Sub main() > > LCD_Init_Ext() 'LCD Init > LCD_CLR() 'LCD löschen > Cursor_Off() 'Cursor ausschalten > > LCD_Ausgabe() > > Do While (1) > LCD_Werte() > AbsDelay(500) > End While > > End Sub > > Sub LCD_Ausgabe() > 'Zeichenausgabe Test > '-------------------- > LCD_Locate_Ext(1,1) 'Zeile 1, Pos 1 > Text = " CTC C-Control " 'auszugebender Text > LCD_Write_Text_Ext() 'Text schreiben > > LCD_Locate_Ext(2,1) 'Zeile 2, Pos 1 > Text = " Mega 128 " > LCD_Write_Text_Ext() > > LCD_Locate_Ext(3,1) > Text = "----------------" > LCD_Write_Text_Ext() > > LCD_Locate_Ext(4,6) > Text = "Volt an AD1" > LCD_Write_Text_Ext() > End Sub > > Sub LCD_Werte() > 'Ausgabe von Varibalen (Zahlen) > '------------------------------ > ADC_1 = GetAdc(1) > UB = ADC_1 * Ref > LCD_Locate_Ext(4,1) > LCD_Write_Float_Ext(UB,2) > > 'Cursor_On() 'Cursor einschalten > 'AbsDelay(1000) '1Sek. warten > 'Cursor_Off() 'Cursor ausschalten > 'AbsDelay(1000) '1Sek. warten > 'LCD_CLR() 'LCD löschen > End Sub > > 'LCD_Write_Ext() > Sub LCD_Write_Ext(Text_Print As Char) > Port_WriteBit(RS,PORT_OFF) ' RS auf high > Hex_To_Bin(Text_Print) ' Hex auf definierte Pins als High & Low Nibble ausgeben > Bin_To_Port() ' Binär auf die Definierten Ports ausgeben > End Sub > > 'LCD_Write_Text() > Sub LCD_Write_Text_Ext() > Dim X1 As Word > X1 = 0 > Do While True > Text_Out = Text(X1) > X1 = X1 + 1 > If Text_Out = 0 Then > Exit > End If > LCD_Write_Ext(Text_Out) > End While > End Sub > > 'LCD_Write_Word_Ext() > Sub LCD_Write_Word_Ext(Var As Word, Len As Word) > Dim Str_Word(22) As Char > Dim X2 As Word > X2 = 0 > Str_WriteWord(Var,10,Str_Word,0,Len) > Do While True > Text_Out = Str_Word(X2) > X2 = X2 + 1 > If Text_Out = 0 Then > Exit > End If > LCD_Write_Ext(Text_Out) > End While > End Sub > > 'LCD_Write_Float_Ext() > Sub LCD_Write_Float_Ext(Var As Single, Len As Word) > Dim Str_Float(22) As Char > Dim X3 As Word > X3 = 0 > Str_WriteFloat(Var,Len,Str_Float,0) > Do While True > Text_Out = Str_Float(X3) > X3 = X3 + 1 > If Text_Out = 0 Then > Exit > End If > LCD_Write_Ext(Text_Out) > End While > End Sub > > 'LCD_Locate_Ext() > Sub LCD_Locate_Ext(Zeile As Byte, Pos As Byte) > Dim Position As Byte > > 'E & RS > Port_WriteBit(RS,PORT_ON) ' RS auf low > > If Zeile = 1 Then > Position = (Pos - 1) > Hex_To_Bin(Position Or 0X80) > Bin_To_Port() > End If > > If Zeile = 2 Then > Position = (Pos - 1) > Hex_To_Bin(Position Or 0XC0) > Bin_To_Port() > End If > > If Zeile = 3 Then > Position = (Pos - 1) > Hex_To_Bin(Position Or 0X90) > Bin_To_Port() > End If > > If Zeile = 4 Then > Position = (Pos - 1) > Hex_To_Bin(Position Or 0XD0) > Bin_To_Port() > End If > > End Sub > > 'LCD_Curser_On() > Sub Cursor_On() > Port_WriteBit(RS,PORT_ON) ' RS auf low > Hex_To_Bin(0X0F) > Bin_To_Port() > End Sub > > 'LCD_Cursor_Off() > Sub Cursor_Off() > Port_WriteBit(RS,PORT_ON) ' RS auf low > Hex_To_Bin(0X0C) > Bin_To_Port() > End Sub > > 'LCD_CLR() > Sub LCD_CLR() > Port_WriteBit(RS,PORT_ON) ' RS auf low > Hex_To_Bin(0X01) > Bin_To_Port() > Hex_To_Bin(0X02) > Bin_To_Port() > End Sub > > 'LCD_Init_Ext() > Sub LCD_Init_Ext() > > 'Ports > Port_DataDirBit(RS,PORT_OUT) ' LCD - RS > Port_DataDirBit(Enable,PORT_OUT)' LCD - E > Port_DataDirBit(D4,PORT_OUT) ' LCD - D.4 > Port_DataDirBit(D5,PORT_OUT) ' LCD - D.5 > Port_DataDirBit(D6,PORT_OUT) ' LCD - D.6 > Port_DataDirBit(D7,PORT_OUT) ' LCD - D.7 > AbsDelay(100) > > 'E & RS > Port_WriteBit(Enable,PORT_ON) ' Enable auf low > AbsDelay(10) > Port_WriteBit(RS,PORT_ON) ' RS auf low > AbsDelay(10) > > 'alle Datenpins low > Port_WriteBit(D4,PORT_ON) ' 0 > Port_WriteBit(D5,PORT_ON) ' 0 > Port_WriteBit(D6,PORT_ON) ' 0 > Port_WriteBit(D7,PORT_ON) ' 0 > AbsDelay(100) > > 'HEX 38 senden, 8Bit Init > Hex_To_Bin(0X38) > Bin_To_Port() > AbsDelay(50) > > 'Hex 02 4Bit Init > Hex_To_Bin(0X02) > Bin_To_Port() > AbsDelay(50) > > 'Cursor ausschalten > Hex_To_Bin(0X0C) > Bin_To_Port() > AbsDelay(50) > > 'HEX 28 senden > Hex_To_Bin(0X28) > Bin_To_Port() > AbsDelay(50) > > End Sub > > 'Hex_To_Bin() > Sub Hex_To_Bin(Hex As Byte) > High_Nibble = (Hex >> 4) ' High Nibble untern 4Bit rausschieben > Low_Nibble = (Hex And &H0F) ' Low Nibble oberen 4Bit rausschieben > End Sub > > 'Bin_To_Port() > Sub Bin_To_Port() > 'Bit7 (High Nibble) > If ((High_Nibble Or 8) <> High_Nibble) Then > Port_WriteBit(D7,PORT_ON) > Else > Port_WriteBit(D7,PORT_OFF) > End If > 'Bit6 > If ((High_Nibble Or 4) <> High_Nibble) Then > Port_WriteBit(D6,PORT_ON) > Else > Port_WriteBit(D6,PORT_OFF) > End If > 'Bit5 > If ((High_Nibble Or 2) <> High_Nibble) Then > Port_WriteBit(D5,PORT_ON) > Else > Port_WriteBit(D5,PORT_OFF) > End If > 'Bit4 > If ((High_Nibble Or 1) <> High_Nibble) Then > Port_WriteBit(D4,PORT_ON) > Else > Port_WriteBit(D4,PORT_OFF) > End If > > 'Datenübernahme bei fallender Flanke > Port_WriteBit(Enable,PORT_OFF) ' Enable auf high > AbsDelay(10) > Port_WriteBit(Enable,PORT_ON) ' Enable auf low > AbsDelay(10) > > 'Bit3 (Low Nibble) > If ((Low_Nibble Or 8) <> Low_Nibble) Then > Port_WriteBit(D7,PORT_ON) > Else > Port_WriteBit(D7,PORT_OFF) > End If > > 'Bit2 > If ((Low_Nibble Or 4) <> Low_Nibble) Then > Port_WriteBit(D6,PORT_ON) > Else > Port_WriteBit(D6,PORT_OFF) > End If > 'Bit1 > If ((Low_Nibble Or 2) <> Low_Nibble) Then > Port_WriteBit(D5,PORT_ON) > Else > Port_WriteBit(D5,PORT_OFF) > End If > 'Bit0 > If ((Low_Nibble Or 1) <> Low_Nibble) Then > Port_WriteBit(D4,PORT_ON) > Else > Port_WriteBit(D4,PORT_OFF) > End If > > 'Datenübernahme bei fallender Flanke > Port_WriteBit(Enable,PORT_OFF) ' Enable auf high > AbsDelay(10) > Port_WriteBit(Enable,PORT_ON) ' Enable auf low > AbsDelay(10) > > End Sub > > 'ADC über GetAdc auslesen > Sub GetAdc(Channel As Byte) As Word > 'Uref ist Versorgung 5Volt, andere Möglichkeiten siehe Hilfe > ADC_Set(ADC_VREF_VCC,Channel) > Return ADC_Read() > End Sub > > Leider kann ich keine Ordner einfügen, das wäre einfacher. > > joga