Hello Henrik,

I tried the code below with case and it does not work
Code:
encoderstate1 var Byte 
duty var Word

Main:
encoderstate1 = PORTA


If switch = 1 Then
 
        Select case encoderstate1

        Case 0
            GoSub GetADC
            GoSub SetPWM           
            OVDCOND = %00100010 'Q4 (PWM5) and Q10 (PWM1)
            PORTC = %00000011   'Q1 and Q7 ON

        Case 1
            GoSub GetADC
            GoSub SetPWM
            OVDCOND = %00000110
            PORTC = %00001100
            End Select
            
EndIf

GoTo Main
What am I doing wrong here ???? in my 2 cases, portA = 0 and portA = 1 in the other one (PORTA.0=1). The first code given with IF... THEN works but not this one ?


PS : I'll try tomorrow morning (don't have access to my pic right now) to put the subroutines just once as well as that "Branch"