The program builds fine, but when I tried to flash code from snap debugger to PIC16F15313 in MPLAB its giving this error. Even though low voltage programming is enabled in code.
"MPLAB has detected that the low voltage configuration bit on the device is off. Because Snap can use only low voltage programming, this configuration bit must be turned on in order to use Snap. You will need to use a different, blank device, or use another debug tool to erase this device, before continuing with Snap. Connection Failed."
I had same issue. My problem was in the wiring of debugger (one wire was not connected). I think that your problem may be similar. LVP should be set in new device by manufacturer.