Robert, you were right. Setting ANSEL and ANSELH fixed it. Thanks.