$regfile = "m8def.dat"
$crystal = 1000000
*
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Timer1 = Pwm , Prescale = 1 , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Down
*
Config Portc.5 = Output : Set Portc.5 : Led0 Alias Portc.5
Config Portc.4 = Output : Set Portc.4 : Led1 Alias Portc.4
Config Portd.0 = Output : Set Portd.0 : Led2 Alias Portd.0
Config Portd.1 = Output : Set Portd.1 : Led3 Alias Portd.1
Config Portd.2 = Output : Set Portd.2 : Led4 Alias Portd.2
Config Portd.3 = Output : Set Portd.3 : Led5 Alias Portd.3
Config Portd.4 = Output : Set Portd.4 : Led6 Alias Portd.4
Config Portd.5 = Output : Set Portd.5 : Led7 Alias Portd.5
Config Portd.6 = Output : Set Portd.6 : Led8 Alias Portd.6
Config Portd.7 = Output : Set Portd.7 : Led9 Alias Portd.7
*
*
Config Portc.0 = Input
Config Portb.1 = Output
*
Dim W As Word
*
Do
*
W = Getadc(0)
W = W / 4
*
Pwm1a = W
*
Select Case W
*
Case 0:
Set Led0
Set Led1
Set Led2
Set Led3
Set Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 1 To 25:
Reset Led0
Set Led1
Set Led2
Set Led3
Set Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 26 To 50:
Reset Led0
Reset Led1
Set Led2
Set Led3
Set Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 51 To 75:
Reset Led0
Reset Led1
Reset Led2
Set Led3
Set Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 76 To 100:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Set Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 101 To 125:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Set Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 126 To 150:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Reset Led5
Set Led6
Set Led7
Set Led8
Set Led9
*
Case 151 To 175:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Reset Led5
Reset Led6
Set Led7
Set Led8
Set Led9
*
Case 176 To 200:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Reset Led5
Reset Led6
Reset Led7
Set Led8
Set Led9
*
Case 201 To 225:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Reset Led5
Reset Led6
Reset Led7
Reset Led8
Set Led9
*
Case 226 To 256:
Reset Led0
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Reset Led5
Reset Led6
Reset Led7
Reset Led8
Reset Led9
*
*
End Select
*
Waitms 20
Loop
*
End
*