So der Code:

$regfile = "m644def.dat"
$hwstack = 64
$swstack = 128
$framesize = 64
$baud = 9600
$crystal = 8000000
$lib "glcdKS108.lib"


Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portd , Ce = 2 , Ce2 = 3 , Cd = 4 , Rd = 5 , Reset = 7 , Enable = 6


Config Adc = Single , Prescaler = 128 , Reference = Internal_2.56

Config Timer1 = Timer , Prescale = 256
Timer1 = 62410
Disable Timer1
On Timer1 Cntfull
Config Portb.0 = Output
Portb.0 = 1

Dim Stehlampes As Byte , Beltimeist As Integer , Beltimesoll As Word , Menutimeist As Integer , Menutimesoll As Word , Stehlampetimesoll As Byte , Einstellungentimesoll As Byte , Tvtimesoll As Byte , Tvtimeist As Byte , Internettimesoll As Byte , Internettimeist As Byte , Wlantimesoll As Byte , Wlantimeist As Byte , Neontimeist As Byte , Neontimesoll As Byte , Lichterkettetimesoll As Byte , Lichterkettetimeist As Byte , Musikanlagetimesoll As Byte , Musikanalgetimeist As Byte
Dim Temp As Byte , X As Word , Y As Word
Dim Menu As Integer
Dim Nacht As Bit , Tv As Bit , Internet As Bit , Wlan As Bit , Neon As Bit , Lichterkette As Bit , Musikanlage As Bit , Leuchtkugel As Bit
Start Adc

Print "Alles wird übertragen"
Menu = 0
Beltimesoll = 150
Beltimeist = 150
Menutimesoll = 150
Menutimeist = 150

Do
Disable Interrupts
If X > 25 And Y > 25 Then : Beltimeist = Beltimesoll : Menutimeist = Menutimesoll : End If
If Beltimeist <= 0 Then : Portb.0 = 0 : Else : Portb.0 = 1 : End If
If Menutimeist <= 0 Then : Menu = 0 : Showpic 0 , 0 , Mainmenu : End If
If Menu = 0 And Beltimeist <= 0 Then : Disable Timer1 : Else : Enable Timer1 : End If

Select Case Menu
Case 0 : Gosub Menu0 'Mainmenu
Case 1 : Gosub Menu1 'Musik
Case 2 : Gosub Menu2 'Steuerung
Case 3 : Gosub Menu3 'Pccontroll
Case 4 : Gosub Menu4 'Einstellungen
Case 5 : Gosub Menu5 'Einstellungen_beltime
Case 6 : Gosub Menu6 'Einstellungen_kontrast
Case 7 : Gosub Menu7 'Einstellungen_menutime
Case 8 : Gosub Menu8 'Einstellungen_nachts_aus
Case 9 : Gosub Menu9 'Einstellungen_nachts_ein
Case 10 : Gosub Menu10 'Einstellungen_nachts_eingabe_bis
Case 11 : Gosub Menu11 'Einstellungen_nachts_eingabe_von
Case 12 : Gosub Menu12 'Einstellungen_steuerung_time
Case 13 : Gosub Menu13 'Internet
Case 14 : Gosub Menu14 'TV
Case 15 : Gosub Menu15 'Wlan
Case 16 : Gosub Menu16 'Neon
Case 17 : Gosub Menu17 'Lichterkette
Case 18 : Gosub Menu18 'Musikanlage
Case 19 : Gosub Menu19 'Stehlampe
Case 20 : Gosub Menu20 'Leuchtkugel
End Select
Enable Interrupts
Waitms 200
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
'Print "VALUE Y : " ; Y ' for debugging
Config Pina.1 = Output ' Makes port F.1 output
Config Pina.3 = Output ' Makes port F.3 output
Reset Porta.1 ' Sets port F.1 Low
Set Porta.3 ' Sets port F.3 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
'Print "VALUE X : " ; X
If X > 25 And Y > 25 And Beltimeist <= 0 Then : Beltimeist = Beltimesoll : Menutimeist = Menutimesoll : Portb.0 = 1 : X = 0 : Y = 0 : Wait 1 : End If
Return


Cntfull:
Timer1 = 62410
Beltimeist = Beltimeist - 1
Menutimeist = Menutimeist - 1
Print "BELTIME" ; Beltimeist
Return