Fail-Safe Monitoring and Clock Frequency Switching
Created: May 15, 2016
No description available.
This reference design is a typical application of PIC16F684 microcontroller of Microchip, which is the fail-safe monitoring, and clock switching. The device contains a fail-safe feature that effectively monitors the external oscillator also known as the primary oscillator, which will automatically switch over to the internal oscillator known as the secondary if the primary oscillator fails. These features make applications more robust in the event of a primary oscillator failure and allow greater flexibility by using the clock frequency switching capabilities of the internal oscillator. The design specifically uses the PIC16F684 microcontroller, which is a 14-pin, flash-based, 8bit CMOS MCU. It has 12 I/O pins with individual direction control.
Setting bit 11 (FCMEN) in the configuration word enables the fail-safe monitoring device. The OSCCON<3> (OSTS), which is a special function for oscillator, indicates when the device is running from the primary or secondary oscillator. When a failure on the primary oscillator is detected, the device will switch over to its secondary oscillator and clear OSCCON<3> (OSTS). To attempt to restart the primary oscillator, set OSCCON<0> (SCS) and then clear OSCCON<0> (SCS). The PIC16F684 internal oscillator can be switched from 8MHz down to 31kHz (8 steps) in real time, while the 16MHz external oscillator is added for some specific application that requires higher frequency. The OSCCON<6:4> (IRCF<2:0>) bits are used to set the frequency for running the internal oscillator.
This device uses an LCD display to show whether the device is running from the primary or secondary oscillator and the frequency that the secondary oscillator is running at. An external crystal oscillator is used as the primary oscillator. The primary crystal oscillator is installed in a socket where it could be easily inserted and removed while the application is running. A potentiometer is used to select the secondary oscillator frequency.