$regfile = "2313def.dat" $crystal = 4000000 Cha Alias Pind.2 Chb Alias Pind.3 Config Chb = Input Config Pind.6 = Output Config Int0 = Falling 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: If Chb = 0 Then Incr Encounter Else Decr Encounter Gifr = 64 Return End