$crystal = 8000000 Config Portb = Output Config Portd.4 = Output Config Portd.5 = Output Config Portd.6 = Output Config Pind.2 = Input 'Taste Portb = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 Portd.2 = 1 'Pullup Enable Interrupts Enable Int0 On Int0 Power_on Config Powermode = Powerdown Do If Pind.2 = 0 Then 'Taste schaltet Gerät aus (Powermode = Powerdown) Portb = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 While Pind.2 = 0 Wend Waitms 100 'Taste entprellen Enable Int0 Config Powermode = Powerdown End If Portb = &B00000001 Waitms 5 Portb = 0 Waitms 20 Portb = &B00000010 Waitms 10 Portb = 0 Waitms 20 Portb = &B00000100 Waitms 15 Portb = 0 Waitms 20 Portb = &B00001000 Waitms 20 Portb = 0 Waitms 20 Portb = &B00010000 Waitms 25 Portb = 0 Waitms 20 Portb = &B00100000 Waitms 30 Portb = 0 Waitms 20 Portb = &B01000000 Waitms 35 Portb = 0 Waitms 20 Portb = &B10000000 Waitms 40 Portb = 0 Waitms 20 Portd.5 = 1 Waitms 45 Portd.5 = 0 Waitms 20 Portd.6 = 1 Waitms 50 Portd.6 = 0 Waitms 20 Loop Power_on: 'Taste schaltet Gerät ein (IRQ0) Disable Int0 Portd.4 = 1 While Pind.2 = 0 Wend Waitms 100 'Taste entprellen Return