Ok then.
I had to take a more detailed look at the datasheet for the register definitions and take a guess from your posted code and the way Microchip usually defines registers in their header files.
So, my best guess at this point is with the initialization of the FVR buffer. First two lines:
FVREN=1; //Enable FVR
CDAFVR1=2; //FVR=2.048V to comparator
Microchip has those confusing definitions (and multiple ways of accessing register fields, probably for legacy reasons). I recommend using a consistent way of accessing those bit fields - will make your life easier and avoid some mistakes. But I'm guessing that you may have found this excerpt above in some example code.
My suggestion is to change the two above lines to:
FVRCONbits.CDAFVR = 2;
FVRCONbits.FVREN = 1;
(hopefully those are correct - I don't have the compiler installed or at least the support header files for this MCU, so if that doesn't compile, you'll probably figure it out easily. For instance, if the 'FVREN' field does not exist, try just 'EN' instead.)
The most probable reason this would work, but not your 2 lines above, is with the "CDAFVR1=2;" line. From what I get (from usual Microchip "legacy" stuff), CDAFVR1 is (again, most likely, but not 100% sure) bit 1 of the CDAFVR field of the FVRCON register, and not the whole CDAFVR[1:0] field (there must be a definition for CDAFVR0, which will confirm that). So if you assign 2 to it, it's the same as assigning 0 to bit 1 (2 = 0 mod 2). And that's the same as having CDAFVR[1:0] = 00 (as I suppose the reset value of bit 0 is also 0), which is "buffer off".
And, I prefer enabling the FVR after setting the gain, but that wouldn't change much in practice.