SCM is widely used in industrial control, home appliances, consumer electronics, medical electronics, instrumentation and other fields. In response to the needs of the majority of junior electronic engineers / MCU enthusiasts, electronic enthusiasts plan and integrate the "Single-chip key technology basics" series of technical articles In the future, other chapters will be launched one after another. Please stay tuned and pay attention to the engineers and friends.
First, the interrupt number and interrupt vector of C51 microcontroller
1, the interrupt number
2, interrupt and using in the C51 interrupt
The basic structure of the 8051 Series MCU includes: 32 I/O ports (4 groups of 8 bit ports); two 16-bit timer counters; full-duplex serial communication; 6 interrupt sources (2 external interrupts, 2 timings / Counter interrupt, 1 serial input/output interrupt), two levels of interrupt priority; 128 bytes of built-in RAM; independent 64K bytes of addressable data and code area. After the interrupt occurs, the MCU goes to one of the five interrupt entries and executes the corresponding interrupt service handler. The entry address of the interrupt program is placed in the interrupt vector by the compiler. The interrupt vector is located at the lowest address of the program code segment. Note that the serial input/output interrupts here share an interrupt vector. The 8051 interrupt vector table is as follows:
Second, the role of the reset circuit of the CPU and the microcontroller and the basic reset mode
During the power-on or reset process, control the reset state of the CPU: keep the CPU in the reset state during this time, instead of working on a power-on or just reset, prevent the CPU from issuing incorrect commands, performing incorrect operations, or improving Electromagnetic compatibility.
Regardless of the type of microcontroller used by the user, the design of the microcontroller reset circuit is always involved. The design of the reset circuit of the single chip directly affects the reliability of the whole system. Many users have designed the MCU system, and after the successful debugging in the laboratory, there have been phenomena such as "dead" and "program flying" on the site. This is mainly caused by the unreliable design of the reset circuit of the MCU.
Basic reset method
The microcontroller needs to be reset at startup to keep the CPU and system components in a certain initial state and start working from the initial state. The reset signal of the 89 series MCU is input from the RST pin to the Schmitt trigger in the chip. When the system is in normal operation and the oscillator is stable, if there is a high level on the RST pin and is maintained for more than 2 machine cycles (24 oscillation cycles), the CPU can respond and reset the system. The reset mode of the single-chip system is: manual button reset and power-on reset.
1, manual button reset
Manual button reset requires manual addition of a high level to the reset input RST (Figure 1). The general method is to connect a button between the RST terminal and the positive power supply Vcc. When the button is pressed artificially, the +5V level of Vcc is directly added to the RST terminal. The manual button reset circuit is as shown. Since the human action is fast, the button remains on for tens of milliseconds, so the time requirement for resetting can be fully met.
figure 1
2, power on reset
The power-on reset circuit of the AT89C51 is shown in Figure 2. As long as a capacitor is connected to the Vcc terminal on the RST reset input pin, a resistor can be connected to the ground. For CMOS type MCUs, since there is a pull-down resistor inside the RST terminal, the external resistor can be removed and the external capacitor can be reduced to 1? F. The power-on reset process is when the power-on is reset, the reset circuit is applied to the RST terminal through a capacitor to a brief high-level signal. The high-level signal gradually falls back with the charging process of the capacitor by Vcc, that is, the high voltage of the RST terminal. The duration of the flat depends on the charging time of the capacitor. In order to ensure that the system can be reliably reset, the high level signal at the RST terminal must be maintained for a sufficient period of time. At power-on, the rise time of Vcc is about 10ms, and the start-up time of the oscillator depends on the oscillation frequency. For example, the crystal frequency is 10MHz, the start-up time is 1ms, the crystal frequency is 1MHz, and the start-up time is 10ms. In the reset circuit of Figure 2, when Vcc is powered down, the voltage at the RST terminal will inevitably fall below 0V quickly. However, due to the limitation of the internal circuit, this negative voltage will not damage the device. In addition, during reset, the port pins are in a random state. After reset, the system sets the port to the all "1" state. If the system does not receive a valid reset at power-on, the program counter PC will not get a suitable initial value, so the CPU may start executing the program from an undefined location.
figure 2
3, integral type power-on reset
A commonly used power-on or switch reset circuit is shown in Figure 3. After power-on, due to the charging of capacitor C3 and the action of the inverting gate, RST is held high for a period of time. When the MCU is already running, pressing the reset button K and releasing it can also make RST a high level for a period of time, thus realizing the operation of power-on or switch reset.
According to the actual operation experience, the capacitance and resistance reference values ​​of this reset circuit are given below.
In Figure 3: C: = 1uF, Rl = lk, R2 = 10k
Figure 3 integral power-on reset circuit
ZGAR bar 600 Puffs
ZGAR electronic cigarette uses high-tech R&D, food grade disposable pod device and high-quality raw material. All package designs are Original IP. Our designer team is from Hong Kong. We have very high requirements for product quality, flavors taste and packaging design. The E-liquid is imported, materials are food grade, and assembly plant is medical-grade dust-free workshops.
Our products include disposable e-cigarettes, rechargeable e-cigarettes, rechargreable disposable vape pen, and various of flavors of cigarette cartridges. From 600puffs to 5000puffs, ZGAR bar Disposable offer high-tech R&D, E-cigarette improves battery capacity, We offer various of flavors and support customization. And printing designs can be customized. We have our own professional team and competitive quotations for any OEM or ODM works.
We supply OEM rechargeable disposable vape pen,OEM disposable electronic cigarette,ODM disposable vape pen,ODM disposable electronic cigarette,OEM/ODM vape pen e-cigarette,OEM/ODM atomizer device.
ZGAR bar 600 Puffs Disposable Vape, bar 600puffs,ZGAR bar 600 Puffs disposable,ZGAR bar 600 Puffs,ZGAR bar 600 Puffs OEM/ODM disposable vape pen atomizer Device E-cig
Zgar International (M) SDN BHD , https://www.zgarvape.com