7.1.1 Priority Lock

The system arbiter grants memory access to the peripheral selections (DMAx, Scanner) as long as the PRLOCKED bit is set. Priority selections are locked by setting the PRLOCKED bit. Setting and clearing this bit requires a special sequence as an extra precaution against inadvertent changes. The following code examples demonstrate the Priority Lock and Priority Unlock sequences.

Priority Lock Sequence

INTCON0bits.GIE = 0; 		// Disable Interrupts;
PRLOCK = 0x55;
PRLOCK = 0xAA;
PRLOCKbits.PRLOCKED = 1; 	// Grant memory access to peripherals;
INTCON0bits.GIE = 1; 		// Enable Interrupts;

Priority Unlock Sequence

INTCON0bits.GIE = 0; 		// Disable Interrupts;
PRLOCK = 0x55;
PRLOCK = 0xAA;
PRLOCKbits.PRLOCKED = 0; 	// Allow changing priority settings;
INTCON0bits.GIE = 1; 		// Enable Interrupts;