How to configure the oscillator of PIC microcontroller

Publisher:数字小巨人Latest update time:2020-08-02 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.


  Users can choose one of the four oscillation modes shown in Table 1 according to different application scenarios (this selection is also required when using a 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 creating a PIC source program, its oscillator mode is determined by bits D1 and D0 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 a resistor Rs (100Ω < Rs < 1kΩ) to the oscillation circuit.


  2. External clock source or external crystal oscillator

  In the three oscillator modes of LP, XT and HS, various PIC series microcontroller chips can use either the internal oscillator or the external input clock source or external crystal oscillator. If an external clock source or 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 oscillators are mainly used in situations where time accuracy requirements are not too high.

  The RC oscillator is a series resistor and capacitor connected to the OSC1/CLKIN pin, as shown in Figure 3. The manufacturer recommends that the resistor Rext value be between 5kΩ and 100kΩ. When Rext is less than 2.2kΩ, 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-divider circuit and then output from OSC2/CLKOUT as a fosc/4 oscillation signal. This signal can be used as a test or synchronization signal for other logic circuits.


Reference address:How to configure the oscillator of PIC microcontroller

Previous article:Design of AD conversion using PIC microcontroller
Next article:Design of Multi-channel AD Switching Program for PIC Microcontroller

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号