ANSEL bit operations require proper mapping between the port bit and the and the analog pin.
This is seen where the a2d channels are not in order on a port or have gaps.
Most processors which use the ANSEL_P class will have this problem.
Anonymous
ANSEL_P class has been modified to solve the issue for a2d channels not changing in and out of analog state. If addition as required by p16f193x processors, ports with ANSEL registers but not a2d ports are now handled.