Hier mal Dein Code zum mitlesen (ohne download)![]()
Code:$regfile = "m32def.dat" $crystal = 7372800 $hwstack = 100 $swstack = 75 $framesize = 40 Config Graphlcd = 240 * 128 , Dataport = Portb , Controlport = Portd , Ce = 2 , Cd = 1 , Wr = 4 , Rd = 3 , Reset = 0 , Fs = 5 , Mode = 6 Config Sda = Portc.1 Config Scl = Portc.0 Config Adc = Single , Prescaler = Auto '****************** Variablen ******************************** 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 Do Gosub Readtouch Locate 3 , 22 Lcd Y ; " analog Y " Locate 4 , 22 Lcd X ; " analog X " If Y > 170 Then Y3 = Y - 170 Y2 = Y3 / 1.89 Y4 = Y2 Else Y4 = 0 End If If X > 150 Then X3 = X - 150 X2 = X3 / 1.78 X4 = X2 Else X4 = 0 End If Locate 5 , 1 Lcd X4 ; " X" Locate 6 , 1 Lcd Y4 ; " Y" 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







Zitieren

Lesezeichen