On 12 Jul 01 Dilan wrote: Dilan- Way down at the bottom of your code shown...this may not be _the_ problem, but it can't be helping: . . . ; ADC Control and Looping BANKSEL ADCON0 ; Bank 0 loop BSF ADCON0, GO poll NOP BTFSC ADCON0, GO GOTO poll MOVF ADRESH, W ; Move result to W =20 MOVF ADRESH, 1 MOVWF CCPR1L ; Adjust the PWM duty with Analog input BANKSEL PORTB ; Bank 2 MOVWF PORTB GOTO loop END Looks to me like Bank 2 is the selected memory bank when the "GOTO loop" instruction is executed. However, the code following loop assumes Bank 0 is selected. Since the "BANKSEL ADCON0" precedes the loop label, its generated code is only executed when "falling through" into loop, rather than when branching directly to loop. Hope that helps. Steve -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics