8.4.2 Fail-Safe Operation
When the external clock fails, the FSCM switches the device clock to the HFINTOSC at 1 MHz clock frequency and sets the OSFIF bit flag of the PIR3 register. Setting this flag will generate an interrupt if the OSFIE bit of the PIE3 register is also set. The device firmware can then take steps to mitigate the problems that may arise from a failed clock. The system clock will continue to be sourced from the internal clock source until the device firmware successfully restarts the external oscillator and switches back to external operation, by writing to the NOSC and NDIV bits of the OSCCON1 register.