Hallo leute,
also ich habe ein Problem mit dem Code von der ersten seit:
Wie kann er den PortB als Datenport nutzen , wenn da doch der SCK (Portb.1) hängt?Code:$regfile = "m128def.dat" $crystal = 16000000 $hwstack = 100 $swstack = 75 $framesize = 40 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 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
Mit dem ATMega32 klappt bei mir das ganze nachdem ich ich Ports hin und her getauscht habe. Aber mit dem ATMega128 kriege ich einfach keine Schrift auf das Display!
Jetzt hab ich irgendwo gelesen, dass einer auch das Problem hatte und einfach den PortB als Datenport genommen hat, und siehe da, es geht auf einmal.
Wie hat er das gemacht? Ich brauche doch den Portb.1 als SCK vom Programmer!? Oder?







Zitieren

Lesezeichen