$regfile = "at26def.dat" $crystal = 1000000 Config Porta = Output Config Portb = Input Portb = &B00001111 Dim N As Byte Dim Led As Byte Do Porta = 0 N = Pinb N = 15 - N If N = 0 Then Porta = 0 End If If 0 < N And N < 8 Then N = N - 1 For Led = 0 To N Porta.led = 1 Next Led End If If 8 <= N Then N = N - 8 For Led = N To 7 Porta.led = 1 Next Led End If Waitms 100 Loop End