Hallo zusammen,
ich muß erstmal sagen ich bin ganz neu dabei (manche würden Noob sagen)
und habe mir als Anfang ein RN-Control gekauft und ein GLCD von LEDSEE
Beides ist da und ich habe folgenden Code in den Mega32 geladen:
Und es passiert nichts ausser die beiden Sounds die ich zum testen eingefügt habe.Code:$regfile = "m32def.dat" $crystal = 16000000 $baud = 9600 $hwstack = 32 $swstack = 32 $framesize = 32 Config Graphlcd = 240 * 128 , Dataport = Portb , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6 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 "T6963 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 Pina.0 = Output ' Makes port F.0 output Config Pina.2 = Output ' Makes port F.0 output Set Porta.0 ' Sets port F.0 High Reset Porta.2 ' Sets port F.2 Low Ddra.1 = 0 ' Sets port F.1 as input Ddra.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 Pina.1 = Output ' Makes port F.1 output Config Pina.3 = Output ' Makes port F.3 output Reset Porta.3 ' Sets port F.3 Low Set Porta.1 ' Sets port F.1 High Ddra.0 = 0 ' Sets port F.0 as input Ddra.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
Ich wollte die Ports so vergeben:
Port A für den Touch
Port B für Daten
Port C für die Steuerung
Angeschlossen habe ich das so:
RN-Control - Display
Port B 0-7 auf 10-17 am Display
C0 - WR 5
C1 - RD 6
C2 - CE 7
C3 - C/D 8
C4 - Reset 9
Am Display noch
VSS 2 auf 0V
VDD 3 auf +5V
Zwischen 3,4 und 19 noch Wiederstände für den Kontrast
(Hab kein Poti)
Nicht Böse sein ich fange wirklich erst an und denke das ich es richtig gemacht habe.
Aber denken ist nicht wissen 8-)
Gruß
MueThoS







Zitieren

Lesezeichen