think it's ANSEL=0 to make it digital
also, your if statement should always return true, or perhaps not in the language you're using, I'm used to C where we'd do if x==1 to test to see if x is 1, whereas x=1 will place 1 in x and always return true on success