14 Questions and Answers about PIC Microcontrollers

Publisher:TranquilDreamsLatest update time:2019-12-10 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

14 Questions and Answers about PIC Microcontrollers

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?

[1] [2]
Reference address:14 Questions and Answers about PIC Microcontrollers

Previous article:Advantages and applications of PIC microcontroller technology
Next article:Introduction to the characteristics and advantages of PIC8-bit 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号