Oscillator Configuration Method of PIC Series Microcontroller[Copy link]
PIC series microcontrollers can work in different oscillator modes. Users can choose one of the following four oscillation modes according to the needs of their system design. The oscillation frequency range is between DC and 20/25MHz, as shown in Table 1.
Users can choose one of the four oscillation modes shown in Table 1 according to different application scenarios (this selection operation is also required when using the PIC programmer) to obtain the best performance-price ratio. Among them, the LP oscillator mode can reduce system power consumption, and the RC oscillator mode can save costs.
When establishing the PIC microcontroller source program, its oscillator mode is determined by the D1 and D0 bits of the configuration register CONFIG, as shown in Table 2. 1? Internal crystal oscillator/ceramic oscillator In the three modes of LP, XT and HS, a quartz crystal or ceramic resonator needs to be connected to both ends of the microcontroller pins OSC1/CLKIN and OSC2/CLKOUT. As shown in Figure 1, only in the HS mode is it necessary to add resistor Rs (100Ω 2? External clock source or external crystal oscillator In the three oscillator modes of LP, XT and HS, various PIC microcontroller chips can use either the internal oscillator or the external input clock source or external crystal oscillator. If an external clock source or an external crystal oscillator is used, the external oscillator output can be connected to the OSC1/CLKIN pin of the chip, and the OSC2/CLKOUT pin can be open. Figure 2 shows the form of an external clock source, and the external crystal independent oscillator is similar to Figure 2. 3? External RC oscillator RC oscillator is mainly used in occasions where time accuracy is not too high.
The RC oscillator is connected to a series resistor and capacitor on the OSC1/CLKIN pin, as shown in Figure 3. The manufacturer recommends that the resistance Rext value be between 5kΩ and 100kΩ. When Rext is less than 2?2kΩ, the operation of the oscillator may become unstable or stop oscillating; when Rext is greater than 1MΩ, the oscillator is susceptible to interference. The oscillation frequency fosc generated by the RC oscillator is divided by the internal 4-divide circuit and output from OSC2/CLKOUT as fosc/4 oscillation signal. This signal can be used as a test or as a synchronization signal for other logic circuits.