$regfile = "2313def.dat" $crystal = 4000000 Cha Alias Pind.2 Chb Alias Pind.3 Config Cha = Input Config Chb = Input Config Pind.6 = Output Config Int0 = Falling Const Debouncetime = 1 Dim Wtime As Byte Dim Encounter As Integer Set Chb On Int0 Getencoder Cls Wtime = 100 Encounter = 0 Enable Interrupts Enable Int0 Do Set Portd.6 Waitms Wtime Upperline Lcd "encounter: " ; Encounter ; " " Reset Portd.6 Waitms Wtime Loop Getencoder: Waitms Debouncetime If Cha = 0 Then If Chb = 0 Then Incr Encounter Else Decr Encounter End If Gifr = 64 Return End