3.4.3 ICSP™ Write Inhibit

ICSP Write Inhibit is a hardware feature that disables the ICSP interface, thereby preventing all external erase/programming access. ICSP Write Inhibit is enabled via the ICSPPED configuration bit but requires the UCB configuration section to be write protected before taking effect.

Disable External ICSP Programming

/* WARNING: When both settings below are programmed into a device,
 * external erase/programming is no longer permitted after the next reset. 
 */

//ICSP Program and Erase disable bit->ICSP program and erase disabled
#pragma config FPED_ICSPPED = ON

//Enable UCB Write (and erase) Protection
#pragma config #pragma config FWPUCB_WPUCB = 0x5B9B12E4