'Die Anweisung bestimmt Controllertyp, hier AVR Mega 32 $regfile = "m32def.dat" 'Stackanweisungen, die eigentlich nur bei größeren Programmen $framesize = 32 $swstack = 32 $hwstack = 32 'Die Frequenz des verwendeten Quarzes $crystal = 16000000 $baud = 9600 Config Timer0 = Timer , Prescale = 256 '8Bit Timer Enable Timer0 On Timer0 Motor_x 'Config Timer2 = Timer , Prescale = 1024 '8 Bit Timer 'Enable Timer2 'On Timer2 Motor_y Config Portc.0 = Output 'X DIR Config Portc.1 = Output 'X CLK Config Portc.2 = Output 'SLEEP 1 = Sleep 0 = Betrieb Portc.0 = 0 Portc.1 = 0 Portc.2 = 1 Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.5 , Rs = Portb.4 Config Lcdbus = 4 'On Urxc Onrxd Enable Urxc Enable Interrupts 'Interrupts global zulassen Dim Speed_x As Byte Dim Gas_x As Byte Cls Locate 1 , 1 Lcd "SYSTEM START..." Print "SYSTEM STARTS UP ..." Wait 3 Cls Lcd "ONLINE..." Print "ONLINE..." Speed_x = 0 Gas_x = 0 Portc.2 = 0 Do If Usr.rxc = 1 Then Gas_x = Udr End If Loop Motor_x: Select Case Gas_x Case 48 Toggle Portc.0 Gas_x = 49 Case 49 If Speed_x < 225 Then Speed_x = Speed_x + 1 End If Case 50 If Speed_x > 50 Then Speed_x = Speed_x - 1 Elseif Speed_x <= 50 Then Gas_x = 48 End If Case 51 If Speed_x > 50 Then Speed_x = Speed_x - 1 End If End Select Toggle Portc.1 Timer0 = Speed_x Return