Hallo,
Nach dem sich die mechanischen arbeiten an meinem Robby dem Ende nähern hab ich begonnen mit dem Display rumzuspielen.
Hab mir dieses Display geholt http://ledsee.com/index.php?page=sho...mart&Itemid=27
und im Prinzip so wie auf dem Bild angeschlossen, allerdings auf nem C-Control Pro Application Board (was anderes hab ich momentan nicht).
Text, Linien und Grafiken anzeigen funktioniert super, nur die Auswertung des Touchscreens funktioniert garnicht.
Ich hab mir nen Code aus dem Forum hier angepasst - aber das einzige was auf dem Display dann zu sehen ist, ist Pixelmüll.
Alls Einsteiger in Bascom und der ganzen µC Thematik stehts bei mir jetzt so ziemlich an - noch dazu weil das Programm ohne Fehler compiliert wird.Code:$regfile = "m128def.dat" ' specify the used micro $crystal = 14745600 ' used crystal frequency $baud = 19200 ' use baud rate $hwstack = 32 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 40 ' default use 40 for the frame space $lib "glcdKS108-192x64.lib" Wait 2 'First we define that we use a graphic LCD Config Graphlcd = 192 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Ce3 = 2 , Cd = 3 , Rd = 4 , Enable = 5 , Reset = 6 , Mode = 8 Config Adc = Single , Prescaler = Auto , Reference = Internal Dim X As Word , Y As Word Dim X2 As Single , Y2 As Single Dim X3 As Single , Y3 As Single Dim X4 As Byte , Y4 As Byte Start Adc 'Cursor Off Cls Locate 1 , 1 : Lcd "KS108 mit Touchscreen an ATMega128" Locate 3 , 1 Lcd "Y-Koordinate analog: " Locate 4 , 1 Lcd "X-Koordinate analog: " Do Gosub Readtouch Locate 3 , 22 Lcd Y ; " " Locate 4 , 22 Lcd X ; " " If Y > 330 Then Y3 = Y - 346 Y2 = Y3 / 2.89 Y4 = Y2 Else Y4 = 0 End If If X > 150 Then X3 = X - 160 X2 = X3 / 2.78 X4 = X2 Else X4 = 0 End If Locate 5 , 1 Lcd X4 ; " " Locate 6 , 1 Lcd Y4 ; " " Pset X4 , Y4 , 255 Loop End Readtouch: Config Pinf.0 = Output ' Makes port F.0 output Config Pinf.2 = Output ' Makes port F.0 output Set Portf.0 ' Sets port F.0 High Reset Portf.2 ' Sets port F.2 Low Ddrf.1 = 0 ' Sets port F.1 as input Ddrf.3 = 0 ' Sets port F.1 as input because we need it now as ad input Waitms 20 ' Wait until the port is stable Y = Getadc(3) ' Read the ad value for the y Y = 1024 - Y ' Invert the reading Config Pinf.1 = Output ' Makes port F.1 output Config Pinf.3 = Output ' Makes port F.3 output Reset Portf.3 ' Sets port F.3 Low Set Portf.1 ' Sets port F.1 High Ddrf.0 = 0 ' Sets port F.0 as input Ddrf.2 = 0 ' Sets port F.2 as input because we need it now as ad input Waitms 20 ' Wait until the port is stable X = Getadc(2) ' Read the ad value for the x X = 1024 - X ' Invert the reading Return
Hab mich schon durchs Forum gegraben aber nicht so wirklich was gefunden - wo hab ich da Fehler drin?







Zitieren

Lesezeichen