$regfile = "attiny2313.dat" $crystal = 1000000 Config Porta = Input Config Portb = Output Config Portd = Output Config Timer0 = Timer , Prescale = 8 Config Debounce = 1 On Timer0 Timer0_int Declare Sub Switch Declare Sub Lednumber Dim N0 As Word Dim N1 As Word Dim N2 As Word Dim N3 As Word Dim M As Word Dim D As Byte Dim Led(10) As Byte Porta = 3 Led(1) = 63 Led(2) = 6 Led(3) = 91 Led(4) = 79 Led(5) = 102 Led(6) = 109 Led(7) = 125 Led(8) = 7 Led(9) = 127 Led(10) = 111 Enable Interrupts Enable Timer0 Do Debounce Pina.0 , 0 , Switch , Sub Call Lednumber If D = 1 Then Portd = 16 Portb = Led(n1) End If If D = 2 Then Portd = 32 Portb = Led(n2) End If If D = 3 Then Portd = 64 Portb = Led(n3) End If Loop End Timer0_int: Incr D If D > 3 Then D = 1 Return Sub Switch Incr N0 If N0 > 999 Then N0 = 0 End Sub Sub Lednumber N3 = N0 / 100 M = N0 Mod 100 N2 = M / 10 N1 = M Mod 10 N3 = N3 + 1 N2 = N2 + 1 N1 = N1 + 1 End Sub