I have a simple program that jumps to a few subroutines, looks for a high on a pin, sends out data to a digital pot and goes back to the main loop.

I'm having an issue that if the pin is high, it should turn on another pin to light an indicator LED. This isnt happening but the data is being sent out to the pot. If I strip away all code except that to turn on the LED, the LED will turn on.

PORTB.7 is the input pin, PORTB.6 is the output to the LED.

The sub routine(s) that are causing issues are below (there are 5 subroutines, all identical except the POT0 value is different.)


Code:
POWER1:

IF PORTB.7 = 1 THEN 
PORTB.6 = 1 AND POT0 = 25
ELSE 
PORTB.6 = 0 AND POT0 = 0
ENDIF

LOW CS
PAUSE 1
SHIFTOUT SDO,SDK,5, [POT0\16]
HIGH CS
PAUSE 1

RETURN