Hi Pablo,

Look in the data sheet under Comparator Module. Look at the "default" POR (power on reset) value in CMCON0.

Now look at the drawing in FIGURE 8-3: COMPARATOR I/O OPERATING MODES.

Place CMCON0 = X in the initialization section of your code.

Replace X with the value shown in this section that will turn "Comparator Off".