You can see that RST is high when the resistor R1=10k in the reset circuit, and RST is low when R1=50. It is obvious that R1=10k is wrong, and the microcontroller cannot work at all when it is in the reset state. . The reason for this is that because the RST pin contains a triode, there is a small amount of off current even in the off state. When R is very large, a weak off current is passed through the high level.
Second, the calculation of the LED series resistance
Usually red patch LED: voltage 1.6V-2.4V, current 2-20mA, brightness changes in 2-5mA, no change in brightness above 5mA.
Third, the port is not enough
At this time, it can be realized by means of an expansion chip, such as the 38-decoder 74HC138 to expand
Fourth, the filter capacitor
The filter capacitor is divided into a high frequency filter capacitor and a low frequency filter capacitor.
1, high-frequency filter capacitors generally use 104 capacity (0.1uF), the purpose is to short-circuit high-frequency components to protect the device from high-frequency interference. Normal IC (integrated) devices are added between the power supply and ground to remove high frequency interference (air static electricity).
2, low-frequency filter capacitors generally use electrolytic capacitors (100uF), the purpose is to remove low-frequency ripple, store a part of energy, stabilize the power supply. Most of them are connected at the power interface, next to high-power components, such as: USB excuse, stepper motor, 1602 backlight display. The withstand voltage is at least 2 times higher than the maximum voltage of the system.
The role of the five-pole transistor
1, switch function:
When LEDS6 is high, it is turned off, and when it is low, it is turned on.
Calculation of current limiting resistor: When the collector current is I, the base current is I/100 (this involves amplification, the collector current is 100 times the base), the PN junction voltage is 0.7V, and R=(5-0.7) )/(I/100)
2, amplification:
Collector current is 100 times the base current
3, level conversion:
When the base is at a high level, the triode is turned on, and the wire on the right side is grounded low. When the base is at a low level, the transistor is turned off and the output is high.
Sixth, the issue of digital tube
The number formed by the digital tube lighting is composed of a, b, c, d, e, f, e, dp (decimal point), and the font and truth table are as shown above.
Seven, current and voltage drive problems
Due to the limited output of the microcontroller, when the load is a lot, you need to add another driver chip, such as 74HC245.
Eight, pull-up resistor
Pull-up resistor selection principle
1. Considering the power saving and chip sinking current capacity should be large enough; the resistance is large and the current is small.
2. It should be small enough to ensure sufficient driving current; the resistance is small and the current is large.
3. For high speed circuits, excessive pull-up resistors may cause the edges to become flat.
Comprehensive consideration: the common value of the pull-up resistor is selected between 1K and 10K, and the pull-down is the same.
Pull-down resistor
Pull-up is to clamp the indeterminate signal through a resistor at a high level, and pull it down.
1, level conversion, increase the output level parameter value.
2, OC gate must be added with a pull resistor to use.
3. Increase the drive capability of ordinary IO pins.
4. Pull down the anti-jamming on the floating pin.
Nine, crystal and reset circuit
Crystal oscillator circuit
1, crystal oscillator selection:
According to the actual system requirements, 6M, 12M, 11.0592M, 20M waiting
2, load capacitance:
Connect two 10 to 30pF capacitors to the ground, usually 20pF.
3, multimeter to measure the crystal:
Directly use the red pen to the crystal oscillator pin, the black pen to the GND, and measure the voltage.
Reset circuit
Reset
Set the internal circuit of the microcontroller to a certain state, and initialize all the registers.
The reset time of the 51 MCU is about 2 mechanical cycles, depending on the chip data sheet.
Generally, by resetting the chip or resetting the circuit, the calculation of the specific resistance and capacitance parameters is searched by google.
Ten, button jitter and elimination
The button is also a mechanical device, which will produce jitter at the moment of pressing or releasing, as shown below:
There are two ways to eliminate it: software de-shake and hardware de-shake. The hardware de-shake is based on the principle that the capacitor is short-circuited to the high-frequency signal.
Software debounce is to detect a key to execute a delay program after the key is closed, and generate a delay of 5ms to 10ms, so that the state of the key is detected again after the leading edge jitter disappears. If the closed state level is still maintained, it is confirmed that there is a real key press. under.
3 Mm /8 Mm Nano Tip,Electronic Board Marker Pen,Touch Board Marker Pens,Infared Smart Board Marker
Shenzhen Ruidian Technology CO., Ltd , https://www.szwisonen.com