Detailed explanation of the key technology foundation of single chip microcomputer (1)

Detailed explanation of the key technology foundation of single chip microcomputer (1)

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

Our Solar lights applied in freeway,avenue,pedestrian,garden,campus,path, military bases,park,driving way,airport,boat dock and so on. LED solar street light relies on solar energy, which is clean, endless and environment-friendly. 

The system is mainly composed of solar panel, light source, controller and battery. In daytime, when there is sunshine, the solar panel can convert the solar energy to electric energy and store it in the battery. 

At night or rainy or cloudy condition, the battery shall supply power for normal lighting. The controller can judge the brightness of daylight and automatically switch on the light.The whole process is operating in completely automatic mode, without human action.

Solar street lights




Solar Street Lights

Solar Street Lights,12-24W Solar Street Light,30-50W Solar Street Light,60W Solar Street Light

Yangzhou Bright Solar Solutions Co., Ltd. , https://www.solarlights.pl