PIC MCU Application Questions and Answers 14 articles

Publisher:皮球Latest update time:2020-02-05 Source: eefocusKeywords:pic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. How to choose crystal in PIC microcontroller oscillation circuit

For a high-reliability system design, the choice of crystal is very important. This is especially true for systems designed with sleep wake-up (often using low voltage for low power consumption). This is because the low 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 at power-on to easily establish oscillation; during sleep wake-up, the circuit disturbance is much smaller than at power-on, and starting oscillation becomes very difficult. In the oscillation circuit, the crystal should be neither over-driven (easy to oscillate to high-order harmonics) nor under-driven (not easy to start oscillating). The selection of the crystal must at least consider the resonant frequency, load capacitance, excitation power, rate-temperature characteristics, and long-term stability.


2. How to determine whether the crystal oscillator in the circuit is overdriven?

Resistor RS is often used to prevent the crystal from being overdriven. Overdriving the crystal will gradually wear out and reduce the contact plating of the crystal, 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 is not overdriven; on the contrary, if the peaks and troughs of the sine wave are flattened and the waveform becomes square, the crystal is overdriven. At this time, resistor RS is needed to prevent the crystal from being overdriven. The easiest way to determine the value of resistor RS is to connect a 5k or 10k trimming resistor in series and slowly increase it from 0 until the sine wave is no longer flattened. This method can find the closest resistor RS value.


3. How to select capacitors C1C2 in crystal oscillator circuits

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 permissible range, the lower the C1C2 value, the better. A larger C value is beneficial to the stability of the oscillator, but it will increase the start-up time.


3. The value of C2 should be greater than the value of C1 so that the crystal oscillator can start oscillating 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 of microcontrollers has a strong load capacity and can provide or inject at least 25mA of current. Therefore, these pins can be used as controllable power supplies in some occasions. 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 for these devices is provided by an I/O pin. When working, the MCU outputs a high level close to VDD on this pin, and a load of several mA is definitely not a problem. If you want to enter low-power mode, the MCU will output a low level close to 0 on this pin. The controlled device will not consume power without power. For example, LCD display circuits, signal modulation circuits, etc. 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 the narrow pulses on the port. The low level width added to /MCLR should be greater than 2US to reset the system, and a low level less than 2US will interfere with the normal operation of the system.


6. How can we improve the accuracy of A/D conversion when using PIC chip with A/D?

1 Make sure your system clock is suitable. If you turn off/on the A/D module, you should wait for a period of time. This period of time is the sampling time. If you change the input channel, you also need to wait for this period of time and the final TADTAD is the time required to complete each bit of A/D conversion. TAD can be selected in ADCS1ADCS0 in ADCON0. 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 terminal is too high, greater than 10Kohms, the sampling current will decrease, thus affecting 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 AN0 less because its next pin is close to OSC1, which will affect the A/D conversion.


4 Finally, in the system, if the frequency of the chip is low, the chip oscillation is the preferred clock for A/D conversion. 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 and enters the SLEEP state, the RC oscillation inside the chip must be selected as the A/D conversion clock signal. This method will improve the conversion accuracy.


7. Can the RC oscillator on the A/D chip of PIC16C7XX be used for the counter?

The function of the RC oscillator inside the 16C71A/D converter is to allow the MCU to be in sleep mode and the main oscillation to stop, so that there is a clock source for A/D conversion. This RC oscillator cannot be used by other circuits due to its internal design limitations. The typical clock frequency of the RC oscillator inside the A/D converter is 250K, but it will vary considerably with the ambient temperature, working voltage, product batch number, etc. The clock source of the timer can choose the internal oscillation frequency or the external pulse input signal. If you can choose the latter, you can easily make the MCU's main frequency very high and the clock overflow rate low. Otherwise, there seems to be no other tricks except using software to count and divide the frequency. 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 the clock oscillation, you can easily choose a low-frequency crystal to complete your design.


8. Why can't the security bit be burned to "Secret" when using PICSTAR-PLUS to program 16CE625-04/P?

When using PICSTAR-PLUS to program the chip, the program code is placed in the computer's RAM. Each time you write a program, the data is downloaded to the programmer through the serial port for programming, so errors may occur. I have no 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%, so it seems that you are using it for mass production. To ensure reliable programming, I recommend that you use the PICKIT programmer produced by Gaoqi.


9. 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 overdriven, which makes it easy to oscillate to high harmonics, nor should it be underdriven, which makes it difficult to start oscillation. This is especially true in systems designed with sleep and wake-up functions (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 is not particularly obvious during power-on reset. The reason is that the circuit has enough disturbance at power-on, and it is easy to establish oscillation. During sleep and wake-up, the circuit disturbance is much smaller than that at power-on, and starting oscillation becomes very difficult. 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. It must be considered that the oscilloscope is connected to the capacitor. The best case is to see a very clean and beautiful sine wave without any waveform distortion, and it must be full-scale and close to VCC and GND. The choice of crystal must at least consider the resonant frequency, load capacitance, excitation power, temperature characteristics, and long-term stability.


10. 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 be neither over-driven (easy to oscillate to high harmonics) nor under-driven (not easy to oscillate). Especially in the design of a system with sleep wake-up, which often uses 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. The reason is that when the circuit is powered on, there is enough disturbance, so it is easy to establish oscillation. When the circuit is woken up from sleep, the disturbance is much smaller than when it is powered on, and it becomes very difficult to oscillate. Some people comment on why the requirements for crystals of PIC microcontrollers are so high. It seems that using 51 has never been so troublesome. Just use whatever you can get.

[1] [2]
Keywords:pic Reference address:PIC MCU Application Questions and Answers 14 articles

Previous article:PIC microcontroller interrupt program example
Next article:Several skills to master in single chip microcomputer development

Recommended ReadingLatest update time:2024-11-16 14:29

Fluke Electric Vehicle Drive System Testing Application Cases
Automobiles consume about 40% of the world's total oil production. Energy shortage (oil) and environmental protection have triggered a boom and direction in the development and manufacturing of electric vehicles. What influences consumers’ decisions to purchase electric vehicles and their experience of us
[Embedded]
Fluke Electric Vehicle Drive System Testing Application Cases
LED driver power supply combined dimming solution
In addition, in order to meet the needs of actual production and power saving, LEDs usually need to be dimmed. The implementation of dimming circuits not only saves energy and reduces waste, but also prevents LEDs from working under overload for a long time, thereby improving the operating efficiency and life of LEDs.
[Power Management]
LED driver power supply combined dimming solution
PIC MCU Application Questions and Answers 14 articles
1. How to choose crystal in PIC microcontroller oscillation circuit For a high-reliability system design, the choice of crystal is very important. This is especially true for systems designed with sleep wake-up (often using low voltage for low power consumption). This is because the low supply voltage reduces the exci
[Microcontroller]
How to choose a C compiler for PIC microcontrollers
If you are compiling for PIC10, PIC12, or PIC16 series microcontrollers, CCS is the best choice, while for PIC18/PIC24/dsPIC/PIC32 series, MCC is the best choice. The only C compilers for PIC microcontrollers are the PICC compiler produced by HI-TECH and the CCS compiler produced by CCS. There is also the C language
[Microcontroller]
How to choose a C compiler for PIC microcontrollers
Introduction to PIC microcontroller C language programming (2)
11.5.7        Absolute positioning of variables in PICC       First of all, it must be emphasized that when writing programs in  C  language, variables are generally located by the compiler and linker at the end. There is no need to know the specific address where the defined variable is placed (except t
[Microcontroller]
Celebrating its 20th anniversary at the end of the year, Automechanika Shanghai 2024 embraces innovation and change to drive sustainable development of the automotive industry
Shanghai, July 26, 2024. Automechanika Shanghai has been deeply involved in the automotive industry for 20 years, taking root in China, a vast land full of vitality and unlimited business opportunities. As a service platform for the entire automotive industry chain integrating information exchange, industry pr
[Automotive Electronics]
Celebrating its 20th anniversary at the end of the year, Automechanika Shanghai 2024 embraces innovation and change to drive sustainable development of the automotive industry
S3C2410 DMA driver development under Linux
There are numerous examples of general driver development under LINUX on the Internet, but perhaps because they are simple, there are very few introductions to DMA drivers. Recently, Zhaoyang spent several days developing a driver for DMA communication of a certain device under Linux on the S3C2410 processor due to wor
[Microcontroller]
What is the rigidity setting of Panasonic servo drive?
The rigidity setting of Panasonic servo drive is an important part of its performance adjustment. The purpose of rigidity setting is to ensure that the servo motor can provide sufficient torque during operation to ensure the stability and accuracy of the system. This article will introduce the principles, methods an
[Embedded]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号