14 Questions and Answers about PIC Microcontrollers
For a high-reliability system design, the choice of crystal is very important, especially for systems 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, and it is easy to establish oscillation. During sleep wake-up, the circuit disturbance is much smaller than that at power-on, and it becomes very difficult to start oscillation. In the oscillation circuit, the crystal cannot be over-driven (easy to oscillate to high harmonics) or under-driven (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 determine whether the crystal oscillator in the circuit is overdriven?
Resistor RS is often used to prevent crystal oscillators from being overdriven. Overdriving a 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 waveform are flattened, making the waveform square, the crystal oscillator is overdriven. At this time, resistor RS is needed to prevent the crystal oscillator from being overdriven. The easiest way to determine the value of resistor RS is to connect a 5k or 10k fine-tuning 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 permissible range, the lower the C1 and C2 values, 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. This will speed up the crystal oscillator start-up when power is turned on.
Any I/O pin of the PIC series microcontroller 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 a controllable power supply. For example, in some low-power designs, it is hoped that some peripheral devices will not consume power or consume as little power as possible when the system is on standby.
At this time, you can consider 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 load of several mA. If you want to enter 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.
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 filter 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. 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, 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 not all A/D channels are 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 chip frequency is low, the A/D conversion clock is preferably the chip oscillation. This will greatly reduce the impact of digital conversion noise. 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 accuracy of the conversion.
7. Can the RC oscillator on the A/D chip of PIC16C7XX be used for a counter?
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 internal RC oscillator clock frequency of 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 MCUs, which have at least another TIMER1 inside, because TIMER1 can have an independent crystal as the reference for the clock oscillation, and 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, you download the data to the programmer through the serial port for programming, so errors may occur. I don't doubt that you have 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 Company.
9. Why does the PIC microcontroller sometimes work normally when powered on, but cannot wake up after entering sleep mode?
(What are the things to pay attention to when selecting crystals in PIC microcontroller applications?)
For a high-reliability system design, the choice of crystal is very important. In the oscillation circuit, the crystal should neither be over-driven (easy to oscillate to high harmonics) nor under-driven (difficult to start oscillation). Especially in the design of a system with sleep wake-up (often using low voltage for low power consumption), if you just use a crystal at hand, your system may have problems. 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, and it is easy to establish oscillation. During sleep wake-up, the disturbance of the circuit is much smaller than that at power-on, and it becomes very difficult to start oscillation.
Some people have commented on why the PIC microcontroller has such high requirements for crystals? It seems that using 51 has never been so troublesome. You can use whatever you can get your hands on, and there is no problem. Wait a minute, the premise of this comparison is not the same. Also, when sleeping, has anyone seen the 51 series not need a 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 oscillation circuit is working at the best point is to use an oscilloscope to view the waveform on the OSC2 pin (the capacitance connected to the oscilloscope must be considered!). The best case scenario 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.
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°C;
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?
Previous article:Advantages and applications of PIC microcontroller technology
Next article:Introduction to the characteristics and advantages of PIC8-bit microcontroller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- [Erha Image Recognition Artificial Intelligence Vision Sensor] 5. Erha Sensor Serial Port Communication Test
- EEWORLD University Hall----Live Replay: TI's Latest Application of Millimeter-Wave Radar in the Automotive Field
- Changes in car rear lighting design
- A collection of essential basic knowledge for electronic engineers
- Last day! Live broadcast with prizes | RSL15 - ON Semiconductor's more efficient, smarter and safer BLE 5.2 Bluetooth chip
- Studying the road to electric motor driving-1
- TI blog post: The principle of BLDC square wave sensorless control using ADC sampling and integration
- EEWORLD University - Tektronix will teach you the oscilloscope usage skills you don't know
- LM2776 charge pump cannot start
- 【Goodbye 2021, Hello 2022】The first time in 2021