Re: MCC is not generating code to clear ANSEL/ANSELH - 18F26K20
ANSEL and ANSELH are to set the mode (analog or digital) of the port I/O pins INPUT state, not the OUTPUT state. Pins selected for output mode will always output digital signals. Pins selected as inputs must have the appropriate ANSEL (or ANSELH) bit set or cleared to get analog or digital mode. MCC will clear this bit automatically if an analog capable pin is selected as a digital input (not affected by simply setting the pins as outputs). You may also set/clear these register bits manually in MCC on the pin manager tab under the Registers tab, there you will see the ANSEL and ANSELH registers.