PIC FAQ 14 questions

Publisher:艺泉阁Latest update time:2016-08-26 Source: eefocusKeywords:PIC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. How to choose a crystal in the oscillation circuit of a PIC microcontroller?
   For a high-reliability system design, the choice of crystal is very important, especially for a system with sleep wake-up (often using low voltage for low power consumption). This is because the low power supply voltage reduces the excitation power provided to the crystal, causing the crystal to start oscillating very slowly or not at all. This phenomenon is not particularly obvious during power-on reset, because the circuit has enough disturbance when powering on, and it is easy to establish oscillation. During sleep wake-up, the circuit disturbance is much smaller than when powering on, and it becomes very difficult to start oscillation. In the oscillation circuit, the crystal cannot be over-excited (easy to oscillate to high harmonics) or under-excited (not easy to start oscillation). The selection of crystal must at least consider: resonant frequency, load capacitance, excitation power, temperature characteristics, and long-term stability.
  2. How to judge whether the crystal oscillator in the circuit is overdriven? 
   Resistor RS is often used to prevent the crystal oscillator from being overdriven. Overdriving the crystal oscillator will gradually wear out and reduce the contact plating of the crystal oscillator, which will cause the frequency to rise. An oscilloscope can be used to detect the OSC output pin. If a very clear sine wave is detected, and the upper and lower limits of the sine wave meet the clock input requirements, the crystal oscillator is not overdriven; on the contrary, if the peaks and troughs of the sine wave are flattened and the waveform becomes square, the crystal oscillator is overdriven. In this case, resistor RS is needed to prevent the crystal oscillator from being overdriven. The simplest way to judge the value of resistor RS is to connect a 5k or 10k trimming resistor in series, starting from 0 and slowly increasing it until the sine wave is no longer flattened. This method can find the closest resistor RS value.
  3. How to choose capacitors C1 and C2 in the crystal oscillator circuit?
  (1): Because each crystal oscillator has its own characteristics, it is best to select external components according to the values ​​provided by the manufacturer.
  (2): Within the permitted range, the lower the C1 and C2 values, the better. Although a larger C value is beneficial to the stability of the oscillator, it will increase the start-up time.
  (3): The C2 value should be greater than the C1 value, so that the crystal oscillator can start up faster when powered on.
  4. What are the characteristics of the I/O pins of the PIC series microcontrollers?
  Any I/O pin of the PIC series microcontrollers has a strong load capacity (at least 25mA of current can be provided or injected). Therefore, in some occasions, these pins can be used as controllable power supplies. For example, in some low-power designs, it is hoped that some surrounding devices will not consume power or consume as little power as possible when the system is on standby. At this time, it can be considered that the power supply of these devices is provided by an I/O pin. When working, the MCU outputs a high level (close to VDD) on this pin, and it is absolutely no problem to carry a few mA of load; if you want to enter the low-power mode, the MCU outputs a low level (close to 0) on this pin, and the controlled device will not consume power without power. For example, LCD display circuits and signal modulation circuits are very suitable for this type of control. 
  5. Why can't the system work properly when it is disturbed by external magnetic and electric fields?
   If there is no filtering circuit in the main control circuit, the chip you use should be connected to a circuit at the /MCLR end that can filter out narrow pulses on the port. Because the low level width added to /MCLR should be greater than 2US, the system can be reset, and a low level less than 2US will interfere with the normal operation of the system. 
  6. When using a PIC chip with A/D, how can the accuracy of A/D conversion be improved?
   (1): Ensure that the clock of your system is appropriate. If you turn off/on the A/D module, you should wait for a period of time, which is the sampling time; if you change the input channel, you also need to wait for this period of time and the final TAD (TAD is the time required to complete each bit of A/D conversion). TAD can be selected in ADCON0 (ADCS1, ADCS0), and it should be between 2US-6US. If TAD is too small, it will not be completely converted at the end of the conversion process; if TAD is too long, the voltage on the sampling capacitor will drop before all conversions are completed. For specific details on the selection of this time, please refer to the relevant data sheet or application formula.
  (2): Usually, if the resistance of the analog signal input is too high (greater than 10Kohms), the sampling current will decrease and thus affect the conversion accuracy. If the input signal cannot change quickly, it is recommended to use a 0.1UF capacitor at the input channel port; it will change the sampling voltage of the analog channel; due to the current supply, the internal holding capacitor is 51.2PF.
  (3): If all A/D channels are not used up, it is best to use the AN0 terminal less. Because its next foot is close to OSC1, it will affect the A/D conversion. (
  4): Finally, in the system, if the chip frequency is low, the A/D conversion clock is preferably the chip oscillation. This will reduce the impact of digital conversion noise to a large extent. At the same time, in the system, after the A/D conversion starts, it enters the SLEEP state and the on-chip RC oscillator must be selected as the A/D conversion clock signal. This method will improve the conversion accuracy. 
  7. Can the PIC16C7XX A/D on-chip RC oscillator be used for counters?
   The function of the RC oscillator inside the 16C71A/D converter is to provide a clock source for A/D conversion when the MCU is in sleep mode (the main oscillator is stopped). This RC oscillator cannot be used by other circuits due to its internal design limitations. The typical value of the RC oscillator clock frequency inside the A/D converter is 250K, but it will vary considerably with the ambient temperature, operating voltage, product batch number, etc. The clock source of the timer can be selected from the internal oscillation frequency or the external pulse input signal. If you can choose the latter, you can easily achieve a high main frequency of the MCU and a low clock overflow rate. Otherwise, there seems to be no other trick except using software to count and divide. Another option is to use other types of MCU, which has at least another TIMER1 inside, because TIMER1 can have an independent crystal as the reference for clock oscillation, and you can easily choose a low-frequency crystal to complete your design.
  8. Why does the PIC microcontroller sometimes work normally when powered on, but cannot wake up after entering sleep mode?
  For a high-reliability system design, the choice of crystal is very important. In the oscillation circuit, the crystal cannot be over-driven (easy to vibrate to high-order harmonics) or under-driven (not easy to start oscillation). Especially in the system designed with sleep wake-up (often using low voltage for low power consumption), if you just pick up a crystal and use it, your system may have problems. This is because the low power supply voltage reduces the excitation power provided to the crystal, causing the crystal to start oscillating very slowly or not at all. This phenomenon It is not particularly obvious during power-on reset because the circuit has enough disturbance during power-on and it is easy to establish oscillation. During sleep wake-up, the disturbance of the circuit is much smaller than that during power-on, and it is very difficult to start oscillation. A simple way to evaluate whether the oscillation circuit is working at the best point is to use an oscilloscope to view the waveform on the OSC2 pin (the oscilloscope must be connected to the capacitor!). The best situation is to see a very clean and beautiful sine wave without any waveform distortion, and it must be full amplitude (close to VCC and GND). The selection of crystals must at least consider: resonant frequency, load
capacitance, excitation power, temperature characteristics, and long-term stability. 
  9. Precautions for crystal selection in PIC microcontroller applications.
   For a high-reliability system design, the choice of crystal is very important. In the oscillation circuit, the crystal should not be over-driven (easy to oscillate to high harmonics) or under-driven (difficult to oscillate). Especially in the design of a system with sleep wake-up (often using low voltage for low power consumption), if you still use a crystal at random, your system may have problems. This is because the low power supply voltage reduces the excitation power provided to the crystal, causing the crystal to oscillate very slowly or not at all. This phenomenon is not particularly obvious during power-on reset, because the circuit has enough disturbance during power-on, and it is easy to establish oscillation. During sleep wake-up, the circuit disturbance is much smaller than during power-on, and it becomes very difficult to oscillate. Some people commented: Why is the requirement of PIC microcontroller for crystal so high? It seems that using 51 has never been so troublesome. You can use whatever you can get, and there is no problem? Wait a minute, the premise of this comparison is not the same. Also during sleep, has anyone seen the 51 series not need reset but only rely on internal or external events to wake up? If you don't need such advanced design technology, PIC can also let you use whatever crystal you can get. A simple way to evaluate whether the oscillator circuit is working at the best point is to use an oscilloscope to look at the waveform on the OSC2 pin (the oscilloscope must be connected to the capacitor!). The best situation is to see a very clean and beautiful sine wave, without any waveform distortion, and at full amplitude (close to VCC and GND). The selection of the crystal must at least consider: resonant frequency, load capacitance, excitation power, temperature characteristics, and long-term stability. 
  10. Why can't the confidentiality bit be burned into confidentiality when using PICSTAR-PLUS to burn 16CE625-04/P?
   When using PICSTAR-PLUS to program the chip, the program code is placed in the computer's RAM. Every time you write a program, the data is downloaded to the burner through the serial port for programming, so errors may occur. I don't doubt that there is a problem with your operation, but please note that PICSTAR-PLUS is a programmer for development purposes and is not recommended for mass production. You can calculate that the error probability is 1%, which seems to be used for mass production. To ensure reliable burning, it is recommended that you use the PICKIT programmer produced by Gaoqi. 
  11. What do the suffixes A/B/C stand for in the PIC microcontroller model?
   In the PIC microcontroller model, the suffixes A/B/C indicate different chip production processes. From A to C, the process is constantly updated. The diameter of the silicon wafer disk (wafer) becomes larger, the line width becomes narrower, and the line spacing becomes denser. More chips can be produced on the same disk, thereby reducing production costs. From a functional perspective, the three are the same. Of course, the new version of the chip will correct some problems in the existing version and the function will be expanded. In terms of performance indicators, there are some differences among the three. One obvious manifestation is the range of power supply voltage. The thinner the line width, the lower the voltage it can withstand. For example, the maximum power supply voltage indicator of PIC16C57 is 6V, while that of 57C is 5.5V. In most cases, the new version of the chip can directly replace the old version. From the problems found so far, the main problem lies in the crystal oscillator circuit. The reason is that the gain of the reverse amplifier inside the oscillation circuit of the new version of the chip is much higher than that of the old one. If the crystal is not selected properly, it may oscillate to high-order harmonics. Some customers also pointed out that the anti-interference performance of the new version of the chip is not better than that of the old version. In fact, there is no sacrifice in the technical indicators we have published in this regard. It is just that due to process reasons, the margin we have left is reduced. Please be careful not to think that the PIC chip has strong anti-interference ability and do not consider the necessary anti-interference measures when designing the circuit. 
  12. How to identify the temperature level of the PIC microcontroller model?
  Take 16C54-04X/P as an example:
  X = None, commercial grade, temperature range is 0-70℃;
  X= I, Industrial grade, -40-85℃;
  X = E, automotive grade, -40-125℃;
  For example: PIC16C54C-04/P Commercial grade PIC16C54C-04I/P Industrial grade PIC16C54C-04E/P Automotive grade
  13. Do the various interrupts of PIC microcontrollers have different priorities?
   Mid-range PIC microcontrollers have only one interrupt entry, and the hardware does not distinguish priorities, but the priority can be determined by software query: first check first act, the priority is high. High-end 17 and 18 series, including the upcoming 16-bit dsPIC, have hardware priority for interrupts. 
  14. Why does the PIC microcontroller sometimes work normally when powered on, but cannot wake up after entering sleep mode?
   For a high-reliability system design, the choice of crystal is very important. In the oscillation circuit, the crystal should not be over-driven (easy to vibrate to high-order harmonics) or under-driven (not easy to start oscillation). Especially in the system designed with sleep wake-up (often using low voltage for low power consumption), if you still use a crystal at random, your system may have problems. This is because the low power supply voltage reduces the excitation power provided to the crystal, causing the crystal to start oscillating very slowly or not at all. This phenomenon is not particularly obvious during power-on reset, because the circuit has enough disturbance during power-on, and it is easy to establish oscillation. During sleep wake-up, the disturbance of the circuit is much smaller than that during power-on, and it is very difficult to start oscillation. A
  simple way to evaluate whether the oscillation circuit is working at the best point is to use an oscilloscope to view the waveform on the OSC2 pin (the oscilloscope must be connected to the capacitor!). The best situation is to see a very clean and beautiful sine wave without any waveform distortion, and it must be full amplitude (close to VCC and GND). The selection of the crystal must at least consider: resonant frequency, load capacitance, excitation power, temperature characteristics, and long-term stability. 
Keywords:PIC Reference address:PIC FAQ 14 questions

Previous article:PIC microcontroller learning experience
Next article:PIC16 Timer and Crystal Oscillator Calculation

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号