$regfile = "8535def.dat" $crystal = 7372800 Config Debounce = 3 $baud = 19200 Const True = 1 Const False = 0 Dim Hi As Byte Dim He As Byte Dim Lo As Byte Dim A As Byte Dim Phase As Bit Dim Index As Byte Dim Los As Byte Dim Ind As Byte Pwm Alias Portc.0 Pw Alias Portc.1 ' Pwm Ausgang Config Timer0 = Timer , Prescale = 8 On Timer0 Timer0_isr ' bei Timer0 ueberlauf zur sub Config Portd = Input Config Portc = Output Portc = 255 Portd = 255 Enable Timer0 ' timer0 interrupt ein Enable Interrupts ' Global Interrupt ein Index = 15 Lo = 255 ' PWM Anfangswert Phase = True Main: Do Debounce Pind.0 , 0 , Tabelle , Sub ' Taste entprellen an Pind.0 Hi = 255 - Lo Waitms 100 ' Wait 100 ms Loop End Timer0_isr: If Phase = True Then If Lo <> 255 Then Reset Pwm End If Timer0 = Lo Phase = False Else Set Pwm Timer0 = Hi Phase = True End If Return Tabelle: Decr Index ' temp variable erhoehen Print "Index = " ; Index If Index = 1 Then ' temp variable abfragen auf max Index = 15 ' bei max variabel 0 End If Lo = Lookup(index , Dta) ' Daten aus Tabelle lesen in LO Print "LO = " ; Lo Return Dta: Data 32 , 48 , 64 , 80 , 96 , 112 , 128 , 144 , 160 , 176 , 192 , 208 , 224 , 240 , 255